Skip to content

Commit

Permalink
replace data key name to the one without "dummy"
Browse files Browse the repository at this point in the history
  • Loading branch information
maruk0chan committed Feb 1, 2024
1 parent 6496cba commit 070d7b2
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
6 changes: 3 additions & 3 deletions stanzas/barchart/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ export default class Barchart extends MetaStanza {
}
if (this.params["event-outgoing_change_selected_nodes"]) {
barGroup.on("click", (_, d) =>
emitSelectedEvent.apply(this, [d[1][0]["__togostanza_id_dummy__"]])
emitSelectedEvent.apply(this, [d[1][0]["__togostanza_id__"]])
);
}

Expand Down Expand Up @@ -410,7 +410,7 @@ function emitSelectedEvent(this: Barchart, id: any) {
const filteredBars = barGroups.filter(".-selected");
const ids = filteredBars
.data()
.map((datum) => datum[1][0]["__togostanza_id_dummy__"]);
.map((datum) => datum[1][0]["__togostanza_id__"]);
const indexInSelectedBars = ids.indexOf(id);
if (indexInSelectedBars === -1) {
ids.push(id);
Expand All @@ -431,6 +431,6 @@ function changeSelectedStyle(this: Barchart, ids: string[]) {
const barGroups = this._graphArea.selectAll("g.bar-group");
barGroups.classed(
"-selected",
(d) => ids.indexOf(d[1][0].__togostanza_id_dummy__) !== -1
(d) => ids.indexOf(d[1][0].__togostanza_id__) !== -1
);
}
4 changes: 2 additions & 2 deletions stanzas/pagination-table/app.vue
Original file line number Diff line number Diff line change
Expand Up @@ -633,10 +633,10 @@ export default defineComponent({
const selectedRows = [...state.selectedRows];
const row = state.responseJSON[actualRowIndex];
const indexInSelectedRows = state.selectedRows.indexOf(
row.__togostanza_id_dummy__
row.__togostanza_id__
);
if (indexInSelectedRows === -1) {
selectedRows.push(row.__togostanza_id_dummy__);
selectedRows.push(row.__togostanza_id__);
} else {
selectedRows.splice(indexInSelectedRows, 1);
}
Expand Down
13 changes: 7 additions & 6 deletions stanzas/piechart/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import MetaStanza from "../../lib/MetaStanza";

interface Datum {
data: {
__togostanza_id_dummy__: string | number;
__togostanza_id__: string | number;
};
}

Expand Down Expand Up @@ -86,9 +86,10 @@ export default class Piechart extends MetaStanza {
.attr("fill", (d) => d.data[colorSym]);

if (this.params["event-outgoing_change_selected_nodes"]) {
pieGroups.on("click", (_, d) =>
emitSelectedEvent.apply(this, [d.data["__togostanza_id_dummy__"]])
);
pieGroups.on("click", (_, d) => {
console.log(d.data);
return emitSelectedEvent.apply(this, [d.data["__togostanza_id__"]]);
});
}

if (showLegend) {
Expand Down Expand Up @@ -146,7 +147,7 @@ function emitSelectedEvent(this: Piechart, id: string | number) {
const filteredPies = pieGroups.filter(".-selected");
const ids = filteredPies
.data()
.map((datum: Datum) => datum.data.__togostanza_id_dummy__);
.map((datum: Datum) => datum.data.__togostanza_id__);
if (!ids.includes(id)) {
ids.push(id);
} else {
Expand All @@ -164,6 +165,6 @@ function emitSelectedEvent(this: Piechart, id: string | number) {
function changeSelectedStyle(this: Piechart, ids: Array<string | number>) {
const pieGroups = this._chartArea.selectAll(".pie-slice");
pieGroups.classed("-selected", (d: Datum) => {
return ids.indexOf(d.data.__togostanza_id_dummy__) !== -1;
return ids.indexOf(d.data.__togostanza_id__) !== -1;
});
}

0 comments on commit 070d7b2

Please sign in to comment.