MCPcopy Create free account
hub / github.com/Codehagen/Badget / onBarClick

Function onBarClick

src/components/ComboChart.tsx:706–725  ·  view source on GitHub ↗
(data: any, _: any, event: React.MouseEvent)

Source from the content-addressed store, hash-verified

704 const stacked = barSeries.type === "stacked";
705
706 function onBarClick(data: any, _: any, event: React.MouseEvent) {
707 event.stopPropagation();
708 if (!onValueChange) return;
709 if (deepEqual(activeBar, { ...data.payload, value: data.value })) {
710 setActiveLegend(undefined);
711 setActiveBar(undefined);
712 onValueChange?.(null);
713 } else {
714 setActiveLegend(data.tooltipPayload?.[0]?.dataKey);
715 setActiveBar({
716 ...data.payload,
717 value: data.value,
718 });
719 onValueChange?.({
720 eventType: "bar",
721 categoryClicked: data.tooltipPayload?.[0]?.dataKey,
722 ...data.payload,
723 });
724 }
725 }
726
727 function onDotClick(itemData: any, event: React.MouseEvent) {
728 event.stopPropagation();

Callers

nothing calls this directly

Calls 1

deepEqualFunction · 0.85

Tested by

no test coverage detected