Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 41 additions & 1 deletion src/components/MultiMatrix.vue
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ export default defineComponent({
const showGridLines = computed(() => store.state.showGridLines);
const aggregated = computed(() => store.state.aggregated);
const filtered = computed(() => store.state.filteredNetwork);
const sliced = computed(() => store.state.slicedNetwork.length > 0);
const cellColorScale = computed(() => store.getters.cellColorScale);
const parentColorScale = computed(() => store.getters.parentColorScale);
const matrixWidth = computed(() => (network.value !== null
Expand Down Expand Up @@ -111,6 +112,7 @@ export default defineComponent({
store.commit.setShowPathTable(value);
},
});
const slicedEdgeArray = computed(() => store.state.slicedNetwork.map((slices) => slices.network).map((slice) => slice.edges));

// Helpers
function isCell(element: unknown): element is Cell {
Expand Down Expand Up @@ -325,10 +327,23 @@ export default defineComponent({
x: j,
y: i,
z: 0,
spark: Array(slicedEdgeArray.value.length).fill(0),
}));
}
});

// Create sparkline values if network is sliced
if (sliced.value) {
slicedEdgeArray.value.forEach((slice, i) => {
slice.forEach((edge) => {
matrix.value[idMap.value[edge._from]][idMap.value[edge._to]].spark[i] += 1;
if (!directionalEdges.value) {
matrix.value[idMap.value[edge._to]][idMap.value[edge._from]].spark[i] += 1;
}
});
});
}

// Count occurrences of edges and store it in the matrix
network.value.edges.forEach((edge: Edge) => {
matrix.value[idMap.value[edge._from]][idMap.value[edge._to]].z += 1;
Expand Down Expand Up @@ -491,6 +506,7 @@ export default defineComponent({
sortKey,
filtered,
lineUpIsNested,
sliced,
};
},

Expand Down Expand Up @@ -639,13 +655,37 @@ export default defineComponent({
:width="cellSize - 2"
:height="cellSize - 2"
:fill="(cell.rowCellType=== 'supernode' && cell.colCellType === 'supernode') || (filtered && (cell.rowCellType === 'supernode' || cell.colCellType === 'supernode')) ? parentColorScale(cell.z) : cellColorScale(cell.z)"
:fill-opacity="cell.z"
:fill-opacity="sliced ? 0 : cell.z"
:class="selectedCell === cell.cellName ? 'cell clicked' : ''"
@mouseover="(event) => {showToolTip(event, cell); hoverEdge(cell);}"
@mouseout="(event) => {hideToolTip(); unHoverEdge(cell);}"
@click="clickElement(cell)"
/>
</g>
<svg
v-for="cell in matrix[i]"
:key="cell.cellName"
class="cellsSparkGroup"
:x="(cell.x * cellSize) + 1"
y="1"
:width="cellSize - 2"
:height="cellSize - 2"
>
<v-sparkline
fill="true"
:color="cellColorScale(cell.z)"
radius="20"
:value="cell.spark"
:class="selectedCell === cell.cellName ? 'cell clicked' : ''"
padding="0"
:height="cellSize - 2"
:width="cellSize - 2"
:fill-opacity="sliced ? 1 : 0"
@mouseover="(event) => {showToolTip(event, cell); hoverEdge(cell);}"
@mouseout="(event) => {hideToolTip(); unHoverEdge(cell);}"
@click="clickElement(cell)"
/>
</svg>
</g>
</g>
<g
Expand Down
1 change: 1 addition & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export interface Cell {
x: number;
y: number;
z: number;
spark: number[];
rowCellType: string;
colCellType: string;
rowID: string;
Expand Down