Hi, Power BI Community--
I'm very new to custom visual development, but I'm at least learning and getting my feet wet. I have downloaded the source code for the Chiclet Slicer, and I would like to see if I can add some additional selection options. Shift-click is top of the list. Second option would be to include range options such as we see in the Date Slicer.
I *think* the code for this comes in this section of the webBehavior.ts file. Can anyone tell me where to start hacking? See code here:
slicers.on("click", (dataPoint: ChicletSlicerDataPoint, index: number) => {
if (!dataPoint.selectable) {
return;
}
(d3.event as MouseEvent).preventDefault();
let settings: ChicletSlicerSettings = this.slicerSettings;
let multiselect: boolean = settings.general.multiselect;
let selectedIndexes: number[] = jQuery.map(
this.dataPoints,
(dataPoint: ChicletSlicerDataPoint, index: number) => {
if (dataPoint.selected) {
return index;
};
});
if (settings.general.forcedSelection && selectedIndexes.length === 1) {
let availableDataPoints: ChicletSlicerDataPoint[] = jQuery.map(
this.dataPoints,
(dataPoint: ChicletSlicerDataPoint, index: number) => {
if (!dataPoint.filtered) {
return dataPoint;
};
});
if (availableDataPoints[index]
&& this.dataPoints[selectedIndexes[0]].identity === availableDataPoints[index].identity) {
return;
}
}
if ((d3.event as MouseEvent).altKey && multiselect) {
let selIndex: number = selectedIndexes.length > 0
? (selectedIndexes[selectedIndexes.length - 1])
: 0;
if (selIndex > index) {
[index, selIndex] = [selIndex, index];
}
selectionHandler.handleClearSelection();
for (let i: number = selIndex; i <= index; i++) {
selectionHandler.handleSelection(this.dataPoints[i], true /* isMultiSelect */);
}
} else if ((((d3.event as MouseEvent).ctrlKey || (d3.event as MouseEvent).metaKey) && !multiselect) || multiselect) {
selectionHandler.handleSelection(dataPoint, true /* isMultiSelect */);
} else {
selectionHandler.handleSelection(dataPoint, false /* isMultiSelect */);
}
this.saveSelection();
});