@adecore/charts 0.41.1 → 0.42.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Root.d.ts +3 -1
- package/dist/Root.js +410 -339
- package/dist/annotations.js +210 -85
- package/dist/axes.d.ts +3 -2
- package/dist/axes.js +541 -74
- package/dist/band.d.ts +2 -0
- package/dist/band.js +10 -0
- package/dist/context.d.ts +3 -0
- package/dist/cursor.d.ts +1 -1
- package/dist/cursor.js +5 -4
- package/dist/locales/en.d.ts +1 -0
- package/dist/locales/en.js +1 -0
- package/dist/locales/nl.d.ts +1 -0
- package/dist/locales/nl.js +1 -0
- package/dist/overlays.js +204 -132
- package/dist/series.d.ts +4 -4
- package/dist/series.js +329 -195
- package/dist/store.d.ts +2 -0
- package/dist/store.js +2 -1
- package/package.json +3 -3
- package/src/Root.tsx +137 -44
- package/src/annotations.tsx +31 -4
- package/src/axes.tsx +182 -6
- package/src/band.ts +13 -0
- package/src/context.ts +9 -0
- package/src/cursor.ts +12 -4
- package/src/locales/en.ts +1 -0
- package/src/locales/nl.ts +1 -0
- package/src/overlays.tsx +51 -1
- package/src/series.tsx +144 -28
- package/src/store.ts +5 -1
package/dist/series.js
CHANGED
|
@@ -3,7 +3,7 @@ import { useContext, useEffect, useId, useRef, useState } from 'react';
|
|
|
3
3
|
import clsx from 'clsx';
|
|
4
4
|
import { area, curveLinear, curveMonotoneX, curveStepAfter, line } from 'd3-shape';
|
|
5
5
|
import { numberOf, readValue, warnOnce } from './access.js';
|
|
6
|
-
import { columnsIn, endRoundedColumn, guessLabelWidth, LABEL_LIFT, placeValueLabels, segmentOf } from './band.js';
|
|
6
|
+
import { columnsIn, endRoundedBar, endRoundedColumn, guessLabelWidth, LABEL_INSET, LABEL_LIFT, placeValueLabels, segmentOf } from './band.js';
|
|
7
7
|
import { colorOf, seriesColor } from './color.js';
|
|
8
8
|
import { BarsContext, useChartContext } from './context.js';
|
|
9
9
|
import { useBeforePaint, useKeyCheck, useRegistration } from './register.js';
|
|
@@ -219,6 +219,9 @@ export function ChartLine(t0) {
|
|
|
219
219
|
t7 = $[9];
|
|
220
220
|
}
|
|
221
221
|
useRegistration(chart.store, "series", id, t7);
|
|
222
|
+
if (chart.horizontal) {
|
|
223
|
+
return null;
|
|
224
|
+
}
|
|
222
225
|
if (chart.points) {
|
|
223
226
|
let t8;
|
|
224
227
|
if ($[10] !== className) {
|
|
@@ -380,6 +383,9 @@ export function ChartPoint(t0) {
|
|
|
380
383
|
valueLabels: false
|
|
381
384
|
});
|
|
382
385
|
const fallback = chart.colors.get(id) ?? seriesColor(0);
|
|
386
|
+
if (chart.horizontal) {
|
|
387
|
+
return null;
|
|
388
|
+
}
|
|
383
389
|
let t1;
|
|
384
390
|
if ($[0] !== className) {
|
|
385
391
|
t1 = clsx("pointer-events-none", className);
|
|
@@ -511,6 +517,9 @@ export function ChartArea(t0) {
|
|
|
511
517
|
t12 = $[11];
|
|
512
518
|
}
|
|
513
519
|
useRegistration(t8, "series", id, t12);
|
|
520
|
+
if (chart.horizontal) {
|
|
521
|
+
return null;
|
|
522
|
+
}
|
|
514
523
|
let t13;
|
|
515
524
|
let tops;
|
|
516
525
|
if ($[12] !== chart || $[13] !== curve || $[14] !== id || $[15] !== values) {
|
|
@@ -689,9 +698,9 @@ export function ChartBars(t0) {
|
|
|
689
698
|
}
|
|
690
699
|
return t4;
|
|
691
700
|
}
|
|
692
|
-
/* Columns, one per bucket: on a `band` scale, or on a `time` scale whose buckets last one step. */
|
|
701
|
+
/* Columns, one per bucket: on a `band` scale, or on a `time` scale whose buckets last one step. Bars per row in a horizontal chart. */
|
|
693
702
|
export function ChartBar(t0) {
|
|
694
|
-
const $ = _c(
|
|
703
|
+
const $ = _c(64);
|
|
695
704
|
const {
|
|
696
705
|
value,
|
|
697
706
|
label,
|
|
@@ -705,8 +714,8 @@ export function ChartBar(t0) {
|
|
|
705
714
|
minHeight: t4,
|
|
706
715
|
rounded: t5,
|
|
707
716
|
valueLabels,
|
|
708
|
-
valueLabelSize:
|
|
709
|
-
animate:
|
|
717
|
+
valueLabelSize: labelSize,
|
|
718
|
+
animate: t6,
|
|
710
719
|
className,
|
|
711
720
|
ref
|
|
712
721
|
} = t0;
|
|
@@ -715,82 +724,137 @@ export function ChartBar(t0) {
|
|
|
715
724
|
const radius = t3 === undefined ? 2 : t3;
|
|
716
725
|
const minHeight = t4 === undefined ? 0 : t4;
|
|
717
726
|
const rounded = t5 === undefined ? "all" : t5;
|
|
718
|
-
const
|
|
719
|
-
const animate = t7 === undefined ? false : t7;
|
|
727
|
+
const animate = t6 === undefined ? false : t6;
|
|
720
728
|
const [chart, id, values] = useSeriesValues("Chart.Bar", value);
|
|
721
729
|
const bars = useContext(BarsContext);
|
|
722
730
|
const labels = useRef(null);
|
|
723
731
|
const [widths, setWidths] = useState(_temp6);
|
|
724
732
|
const rows = chart.data;
|
|
725
|
-
let
|
|
733
|
+
let t7;
|
|
726
734
|
if ($[0] !== chart || $[1] !== tone) {
|
|
727
|
-
|
|
735
|
+
t7 = tonesOf(chart, tone);
|
|
728
736
|
$[0] = chart;
|
|
729
737
|
$[1] = tone;
|
|
730
|
-
$[2] =
|
|
738
|
+
$[2] = t7;
|
|
731
739
|
} else {
|
|
732
|
-
|
|
740
|
+
t7 = $[2];
|
|
733
741
|
}
|
|
734
|
-
const [color, rowColors] =
|
|
742
|
+
const [color, rowColors] = t7;
|
|
735
743
|
const labeled = valueLabels !== undefined && valueLabels !== false;
|
|
736
|
-
const
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
744
|
+
const {
|
|
745
|
+
horizontal
|
|
746
|
+
} = chart;
|
|
747
|
+
const valueLabelSize = labelSize ?? (horizontal ? "xs" : "2xs");
|
|
748
|
+
const stack = bars?.stack === true ? bars.id : null;
|
|
749
|
+
let t8;
|
|
750
|
+
if ($[3] !== chart || $[4] !== valueLabels) {
|
|
751
|
+
t8 = typeof valueLabels === "function" ? valueLabels : amount => chart.formatY(amount);
|
|
752
|
+
$[3] = chart;
|
|
753
|
+
$[4] = valueLabels;
|
|
754
|
+
$[5] = t8;
|
|
755
|
+
} else {
|
|
756
|
+
t8 = $[5];
|
|
757
|
+
}
|
|
758
|
+
const writeValue = t8;
|
|
759
|
+
const totals = horizontal && stack !== null;
|
|
760
|
+
let t9;
|
|
761
|
+
if ($[6] !== chart.series || $[7] !== id || $[8] !== labeled || $[9] !== stack || $[10] !== totals) {
|
|
762
|
+
t9 = labeled && (!totals || [...chart.series].findLast(t10 => {
|
|
763
|
+
const [, entry] = t10;
|
|
764
|
+
return entry.stack === stack && entry.valueLabels;
|
|
765
|
+
})?.[0] === id);
|
|
766
|
+
$[6] = chart.series;
|
|
767
|
+
$[7] = id;
|
|
768
|
+
$[8] = labeled;
|
|
769
|
+
$[9] = stack;
|
|
770
|
+
$[10] = totals;
|
|
771
|
+
$[11] = t9;
|
|
772
|
+
} else {
|
|
773
|
+
t9 = $[11];
|
|
774
|
+
}
|
|
775
|
+
const writesLabels = t9;
|
|
776
|
+
const others = totals ? [...chart.series].flatMap(t10 => {
|
|
777
|
+
const [seriesId, entry_0] = t10;
|
|
778
|
+
return entry_0.stack === stack && seriesId !== id ? [entry_0] : [];
|
|
779
|
+
}) : [];
|
|
780
|
+
const labelValueAt = index => {
|
|
781
|
+
const parts = [values[index], ...others.map(entry_1 => entry_1.values[index])].filter(_temp7);
|
|
782
|
+
return parts.length === 0 ? null : parts.reduce(_temp8, 0);
|
|
783
|
+
};
|
|
784
|
+
const rowTexts = values.map((_, index_0) => {
|
|
785
|
+
const amount_0 = labelValueAt(index_0);
|
|
786
|
+
return horizontal && writesLabels && amount_0 !== null ? writeValue(amount_0, rows[index_0], index_0) : "";
|
|
787
|
+
});
|
|
788
|
+
let t11;
|
|
789
|
+
if ($[12] !== valueLabelSize || $[13] !== widths) {
|
|
790
|
+
t11 = text => widths.get(text) ?? guessLabelWidth(text, valueLabelSize);
|
|
791
|
+
$[12] = valueLabelSize;
|
|
792
|
+
$[13] = widths;
|
|
793
|
+
$[14] = t11;
|
|
794
|
+
} else {
|
|
795
|
+
t11 = $[14];
|
|
796
|
+
}
|
|
797
|
+
const widthOf = t11;
|
|
798
|
+
const endRoom = horizontal && writesLabels ? Math.max(0, ...rowTexts.map(widthOf)) + LABEL_INSET + 2 : 0;
|
|
799
|
+
const t12 = bars?.id ?? null;
|
|
800
|
+
const t13 = icon ?? null;
|
|
801
|
+
let t14;
|
|
802
|
+
if ($[15] !== color || $[16] !== dimOpacity || $[17] !== endRoom || $[18] !== label || $[19] !== labeled || $[20] !== rowColors || $[21] !== stack || $[22] !== t12 || $[23] !== t13 || $[24] !== values) {
|
|
803
|
+
t14 = {
|
|
742
804
|
kind: "bar",
|
|
743
805
|
label,
|
|
744
806
|
color,
|
|
745
807
|
rowColors,
|
|
746
808
|
values,
|
|
747
|
-
stack
|
|
748
|
-
bars:
|
|
809
|
+
stack,
|
|
810
|
+
bars: t12,
|
|
749
811
|
curve: "linear",
|
|
750
|
-
icon:
|
|
812
|
+
icon: t13,
|
|
751
813
|
valueLabels: labeled,
|
|
752
|
-
dimOpacity
|
|
814
|
+
dimOpacity,
|
|
815
|
+
endRoom
|
|
753
816
|
};
|
|
754
|
-
$[
|
|
755
|
-
$[
|
|
756
|
-
$[
|
|
757
|
-
$[
|
|
758
|
-
$[
|
|
759
|
-
$[
|
|
760
|
-
$[
|
|
761
|
-
$[
|
|
762
|
-
$[
|
|
763
|
-
$[
|
|
817
|
+
$[15] = color;
|
|
818
|
+
$[16] = dimOpacity;
|
|
819
|
+
$[17] = endRoom;
|
|
820
|
+
$[18] = label;
|
|
821
|
+
$[19] = labeled;
|
|
822
|
+
$[20] = rowColors;
|
|
823
|
+
$[21] = stack;
|
|
824
|
+
$[22] = t12;
|
|
825
|
+
$[23] = t13;
|
|
826
|
+
$[24] = values;
|
|
827
|
+
$[25] = t14;
|
|
764
828
|
} else {
|
|
765
|
-
|
|
829
|
+
t14 = $[25];
|
|
766
830
|
}
|
|
767
|
-
useRegistration(chart.store, "series", id,
|
|
768
|
-
let
|
|
769
|
-
if ($[
|
|
770
|
-
|
|
771
|
-
$[
|
|
772
|
-
$[
|
|
831
|
+
useRegistration(chart.store, "series", id, t14);
|
|
832
|
+
let t15;
|
|
833
|
+
if ($[26] !== chart) {
|
|
834
|
+
t15 = chart.xScale === "time" && chart.data.length > 0 && chart.bucketAt(0) === null;
|
|
835
|
+
$[26] = chart;
|
|
836
|
+
$[27] = t15;
|
|
773
837
|
} else {
|
|
774
|
-
|
|
838
|
+
t15 = $[27];
|
|
775
839
|
}
|
|
776
|
-
const noSlot =
|
|
777
|
-
let
|
|
778
|
-
let
|
|
779
|
-
if ($[
|
|
780
|
-
|
|
840
|
+
const noSlot = t15;
|
|
841
|
+
let t16;
|
|
842
|
+
let t17;
|
|
843
|
+
if ($[28] !== noSlot) {
|
|
844
|
+
t16 = () => {
|
|
781
845
|
if (noSlot) {
|
|
782
846
|
warnOnce("Chart.Bar: a time scale with one row draws no columns without a `step` on the root.");
|
|
783
847
|
}
|
|
784
848
|
};
|
|
785
|
-
|
|
786
|
-
$[
|
|
787
|
-
$[
|
|
788
|
-
$[
|
|
849
|
+
t17 = [noSlot];
|
|
850
|
+
$[28] = noSlot;
|
|
851
|
+
$[29] = t16;
|
|
852
|
+
$[30] = t17;
|
|
789
853
|
} else {
|
|
790
|
-
|
|
791
|
-
|
|
854
|
+
t16 = $[29];
|
|
855
|
+
t17 = $[30];
|
|
792
856
|
}
|
|
793
|
-
useEffect(
|
|
857
|
+
useEffect(t16, t17);
|
|
794
858
|
const {
|
|
795
859
|
slot,
|
|
796
860
|
count
|
|
@@ -799,195 +863,258 @@ export function ChartBar(t0) {
|
|
|
799
863
|
count: 1
|
|
800
864
|
};
|
|
801
865
|
const stacked = chart.stacked.get(id);
|
|
802
|
-
let
|
|
803
|
-
if ($[
|
|
804
|
-
|
|
805
|
-
$[
|
|
806
|
-
$[
|
|
807
|
-
$[
|
|
866
|
+
let t18;
|
|
867
|
+
if ($[31] !== chart.colors || $[32] !== id) {
|
|
868
|
+
t18 = chart.colors.get(id) ?? seriesColor(0);
|
|
869
|
+
$[31] = chart.colors;
|
|
870
|
+
$[32] = id;
|
|
871
|
+
$[33] = t18;
|
|
808
872
|
} else {
|
|
809
|
-
|
|
873
|
+
t18 = $[33];
|
|
810
874
|
}
|
|
811
|
-
const fallback =
|
|
875
|
+
const fallback = t18;
|
|
812
876
|
const anySelected = chart.selected.some(Boolean);
|
|
813
|
-
let
|
|
814
|
-
if ($[
|
|
815
|
-
|
|
877
|
+
let t19;
|
|
878
|
+
if ($[34] !== chart.band?.groups || $[35] !== values.length) {
|
|
879
|
+
t19 = index_1 => chart.band?.groups.find(run => index_1 >= run.first && index_1 <= run.last) ?? {
|
|
816
880
|
first: 0,
|
|
817
881
|
last: values.length - 1
|
|
818
882
|
};
|
|
819
|
-
$[
|
|
820
|
-
$[
|
|
821
|
-
$[
|
|
822
|
-
} else {
|
|
823
|
-
t17 = $[23];
|
|
824
|
-
}
|
|
825
|
-
const groupOf = t17;
|
|
826
|
-
let t18;
|
|
827
|
-
if ($[24] !== chart || $[25] !== valueLabels) {
|
|
828
|
-
t18 = typeof valueLabels === "function" ? valueLabels : amount => chart.formatY(amount);
|
|
829
|
-
$[24] = chart;
|
|
830
|
-
$[25] = valueLabels;
|
|
831
|
-
$[26] = t18;
|
|
883
|
+
$[34] = chart.band?.groups;
|
|
884
|
+
$[35] = values.length;
|
|
885
|
+
$[36] = t19;
|
|
832
886
|
} else {
|
|
833
|
-
|
|
887
|
+
t19 = $[36];
|
|
834
888
|
}
|
|
835
|
-
const
|
|
836
|
-
const
|
|
837
|
-
const
|
|
838
|
-
|
|
889
|
+
const groupOf = t19;
|
|
890
|
+
const focusOf = index_2 => {
|
|
891
|
+
const focused = index_2 === chart.activeIndex || chart.selected[index_2] === true;
|
|
892
|
+
return {
|
|
893
|
+
focused,
|
|
894
|
+
outOfFocus: chart.dimmed[index_2] === true || anySelected && !focused
|
|
895
|
+
};
|
|
896
|
+
};
|
|
897
|
+
const drawn = values.flatMap((amount_1, index_3) => {
|
|
898
|
+
const top = stacked?.top[index_3];
|
|
899
|
+
const base = stacked?.base[index_3] ?? 0;
|
|
839
900
|
const topPixel = top === null || top === undefined ? null : chart.pixelOfY(top);
|
|
840
|
-
const basePixel = chart.pixelOfY(base) ?? chart.plot.bottom;
|
|
841
|
-
const bucket = chart.bucketAt(
|
|
842
|
-
if (
|
|
901
|
+
const basePixel = chart.pixelOfY(base) ?? (horizontal ? chart.plot.left : chart.plot.bottom);
|
|
902
|
+
const bucket = chart.bucketAt(index_3);
|
|
903
|
+
if (amount_1 === null || topPixel === null || bucket === null) {
|
|
843
904
|
return [];
|
|
844
905
|
}
|
|
845
906
|
const column = columnsIn(bucket.left, bucket.width, count, columnWidth)[slot];
|
|
907
|
+
const least = stack === null ? minHeight : 0;
|
|
908
|
+
let box;
|
|
909
|
+
if (horizontal) {
|
|
910
|
+
const segment = segmentOf(-topPixel, -basePixel, base === 0, amount_1, least);
|
|
911
|
+
box = {
|
|
912
|
+
x: -(segment.y + segment.height),
|
|
913
|
+
y: column.x,
|
|
914
|
+
width: segment.height,
|
|
915
|
+
height: column.width
|
|
916
|
+
};
|
|
917
|
+
} else {
|
|
918
|
+
const segment_0 = segmentOf(topPixel, basePixel, base === 0, amount_1, least);
|
|
919
|
+
box = {
|
|
920
|
+
x: column.x,
|
|
921
|
+
y: segment_0.y,
|
|
922
|
+
width: column.width,
|
|
923
|
+
height: segment_0.height
|
|
924
|
+
};
|
|
925
|
+
}
|
|
846
926
|
const {
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
} =
|
|
850
|
-
const
|
|
851
|
-
|
|
852
|
-
const run_0 = groupOf(index_0);
|
|
853
|
-
let alpha = focused ? 1 : opacity?.(rows[index_0], index_0 - run_0.first, run_0.last - run_0.first + 1) ?? 1;
|
|
927
|
+
focused: focused_0,
|
|
928
|
+
outOfFocus
|
|
929
|
+
} = focusOf(index_3);
|
|
930
|
+
const run_0 = groupOf(index_3);
|
|
931
|
+
let alpha = focused_0 ? 1 : opacity?.(rows[index_3], index_3 - run_0.first, run_0.last - run_0.first + 1) ?? 1;
|
|
854
932
|
if (outOfFocus) {
|
|
855
933
|
alpha = alpha * dimOpacity;
|
|
856
934
|
} else {
|
|
857
|
-
if (chart.activeIndex >= 0 && !
|
|
935
|
+
if (chart.activeIndex >= 0 && !focused_0) {
|
|
858
936
|
alpha = alpha * hoverOpacity;
|
|
859
937
|
}
|
|
860
938
|
}
|
|
861
|
-
const
|
|
939
|
+
const text_0 = labeled && !horizontal ? writeValue(amount_1, rows[index_3], index_3) : "";
|
|
862
940
|
return [{
|
|
863
|
-
index:
|
|
864
|
-
|
|
865
|
-
y,
|
|
866
|
-
height,
|
|
941
|
+
index: index_3,
|
|
942
|
+
box,
|
|
867
943
|
alpha,
|
|
868
944
|
outOfFocus,
|
|
869
|
-
text
|
|
945
|
+
text: text_0
|
|
870
946
|
}];
|
|
871
947
|
});
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
center: column_0.x + column_0.width / 2,
|
|
882
|
-
top: y_0,
|
|
883
|
-
width: widths.get(text_0) ?? guessLabelWidth(text_0, valueLabelSize)
|
|
884
|
-
};
|
|
948
|
+
const labelTops = horizontal ? [] : placeValueLabels(drawn.map(t20 => {
|
|
949
|
+
const {
|
|
950
|
+
box: box_0,
|
|
951
|
+
text: text_1
|
|
952
|
+
} = t20;
|
|
953
|
+
return {
|
|
954
|
+
center: box_0.x + box_0.width / 2,
|
|
955
|
+
top: box_0.y,
|
|
956
|
+
width: widthOf(text_1)
|
|
885
957
|
};
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
958
|
+
}), valueLabelSize);
|
|
959
|
+
const rowLabels = rowTexts.flatMap((text_2, index_4) => {
|
|
960
|
+
const total = labelValueAt(index_4);
|
|
961
|
+
const bucket_0 = chart.bucketAt(index_4);
|
|
962
|
+
if (text_2 === "" || total === null || bucket_0 === null) {
|
|
963
|
+
return [];
|
|
964
|
+
}
|
|
965
|
+
const column_0 = columnsIn(bucket_0.left, bucket_0.width, count, columnWidth)[slot];
|
|
966
|
+
const own = totals ? undefined : drawn.find(entry_2 => entry_2.index === index_4)?.box;
|
|
967
|
+
const end = own === undefined ? chart.pixelOfY(total) ?? chart.plot.left : total >= 0 ? own.x + own.width : own.x;
|
|
968
|
+
return [{
|
|
969
|
+
index: index_4,
|
|
970
|
+
text: text_2,
|
|
971
|
+
x: Math.round(total >= 0 ? end + LABEL_INSET : end - LABEL_INSET),
|
|
972
|
+
y: Math.round(column_0.x + column_0.width / 2),
|
|
973
|
+
anchor: total >= 0 ? "start" : "end",
|
|
974
|
+
outOfFocus: focusOf(index_4).outOfFocus
|
|
975
|
+
}];
|
|
976
|
+
});
|
|
977
|
+
let t21;
|
|
978
|
+
if ($[37] !== widths) {
|
|
979
|
+
t21 = () => {
|
|
896
980
|
const texts = [...(labels.current?.querySelectorAll("text") ?? [])];
|
|
897
981
|
if (texts.length === 0 || typeof texts[0].getComputedTextLength !== "function") {
|
|
898
982
|
return;
|
|
899
983
|
}
|
|
900
|
-
const next = new Map(texts.map(
|
|
901
|
-
if (next.size !== widths.size || [...next].some(
|
|
902
|
-
const [
|
|
903
|
-
return widths.get(
|
|
984
|
+
const next = new Map(texts.map(_temp9));
|
|
985
|
+
if (next.size !== widths.size || [...next].some(t22 => {
|
|
986
|
+
const [text_3, width] = t22;
|
|
987
|
+
return widths.get(text_3) !== width;
|
|
904
988
|
})) {
|
|
905
989
|
setWidths(next);
|
|
906
990
|
}
|
|
907
991
|
};
|
|
908
|
-
$[
|
|
909
|
-
$[
|
|
992
|
+
$[37] = widths;
|
|
993
|
+
$[38] = t21;
|
|
910
994
|
} else {
|
|
911
|
-
|
|
995
|
+
t21 = $[38];
|
|
912
996
|
}
|
|
913
|
-
useBeforePaint(
|
|
914
|
-
let
|
|
915
|
-
if ($[
|
|
916
|
-
|
|
917
|
-
$[
|
|
918
|
-
$[
|
|
997
|
+
useBeforePaint(t21);
|
|
998
|
+
let t22;
|
|
999
|
+
if ($[39] !== className) {
|
|
1000
|
+
t22 = clsx("pointer-events-none", className);
|
|
1001
|
+
$[39] = className;
|
|
1002
|
+
$[40] = t22;
|
|
919
1003
|
} else {
|
|
920
|
-
|
|
1004
|
+
t22 = $[40];
|
|
921
1005
|
}
|
|
922
|
-
let
|
|
923
|
-
if ($[
|
|
924
|
-
|
|
925
|
-
|
|
1006
|
+
let t23;
|
|
1007
|
+
if ($[41] !== animate || $[42] !== horizontal) {
|
|
1008
|
+
t23 = animate ? clsx("transition-[scale] duration-400 ease-out motion-reduce:transition-none", horizontal ? "starting:scale-x-0" : "starting:scale-y-0") : undefined;
|
|
1009
|
+
$[41] = animate;
|
|
1010
|
+
$[42] = horizontal;
|
|
1011
|
+
$[43] = t23;
|
|
1012
|
+
} else {
|
|
1013
|
+
t23 = $[43];
|
|
1014
|
+
}
|
|
1015
|
+
let t24;
|
|
1016
|
+
if ($[44] !== animate || $[45] !== chart || $[46] !== horizontal) {
|
|
1017
|
+
t24 = animate ? {
|
|
1018
|
+
transformOrigin: horizontal ? `${groundOf(chart)}px 0px` : `0px ${groundOf(chart)}px`
|
|
926
1019
|
} : undefined;
|
|
927
|
-
$[
|
|
928
|
-
$[
|
|
929
|
-
$[
|
|
1020
|
+
$[44] = animate;
|
|
1021
|
+
$[45] = chart;
|
|
1022
|
+
$[46] = horizontal;
|
|
1023
|
+
$[47] = t24;
|
|
930
1024
|
} else {
|
|
931
|
-
|
|
1025
|
+
t24 = $[47];
|
|
932
1026
|
}
|
|
933
|
-
let
|
|
934
|
-
if ($[
|
|
935
|
-
|
|
1027
|
+
let t25;
|
|
1028
|
+
if ($[48] !== color || $[49] !== fallback || $[50] !== horizontal || $[51] !== radius || $[52] !== rounded || $[53] !== rowColors || $[54] !== stack || $[55] !== values) {
|
|
1029
|
+
t25 = t26 => {
|
|
936
1030
|
const {
|
|
937
|
-
index:
|
|
938
|
-
|
|
939
|
-
y: y_1,
|
|
940
|
-
height: height_0,
|
|
1031
|
+
index: index_5,
|
|
1032
|
+
box: box_1,
|
|
941
1033
|
alpha: alpha_0
|
|
942
|
-
} =
|
|
943
|
-
const
|
|
944
|
-
const
|
|
1034
|
+
} = t26;
|
|
1035
|
+
const thickness = horizontal ? box_1.height : box_1.width;
|
|
1036
|
+
const corner = stack !== null ? 0 : Math.min(radius, Math.floor(thickness / 4));
|
|
1037
|
+
const fill = rowColors?.[index_5] ?? color ?? fallback;
|
|
1038
|
+
const forward = (values[index_5] ?? 0) >= 0;
|
|
945
1039
|
return rounded === "end" && corner > 0 ? /*#__PURE__*/_jsx("path", {
|
|
946
|
-
d:
|
|
1040
|
+
d: horizontal ? endRoundedBar(box_1.x, box_1.y, box_1.width, box_1.height, corner, forward) : endRoundedColumn(box_1.x, box_1.y, box_1.width, box_1.height, corner, forward),
|
|
947
1041
|
opacity: alpha_0,
|
|
948
1042
|
style: {
|
|
949
1043
|
fill
|
|
950
1044
|
}
|
|
951
|
-
},
|
|
952
|
-
|
|
953
|
-
y: y_1,
|
|
954
|
-
width: column_1.width,
|
|
955
|
-
height: height_0,
|
|
1045
|
+
}, index_5) : /*#__PURE__*/_jsx("rect", {
|
|
1046
|
+
...box_1,
|
|
956
1047
|
rx: corner,
|
|
957
1048
|
opacity: alpha_0,
|
|
958
1049
|
style: {
|
|
959
1050
|
fill
|
|
960
1051
|
}
|
|
961
|
-
},
|
|
1052
|
+
}, index_5);
|
|
1053
|
+
};
|
|
1054
|
+
$[48] = color;
|
|
1055
|
+
$[49] = fallback;
|
|
1056
|
+
$[50] = horizontal;
|
|
1057
|
+
$[51] = radius;
|
|
1058
|
+
$[52] = rounded;
|
|
1059
|
+
$[53] = rowColors;
|
|
1060
|
+
$[54] = stack;
|
|
1061
|
+
$[55] = values;
|
|
1062
|
+
$[56] = t25;
|
|
1063
|
+
} else {
|
|
1064
|
+
t25 = $[56];
|
|
1065
|
+
}
|
|
1066
|
+
let t26;
|
|
1067
|
+
if ($[57] !== chart.halo || $[58] !== dimOpacity || $[59] !== valueLabelSize) {
|
|
1068
|
+
t26 = t27 => {
|
|
1069
|
+
const {
|
|
1070
|
+
index: index_6,
|
|
1071
|
+
text: text_4,
|
|
1072
|
+
x,
|
|
1073
|
+
y,
|
|
1074
|
+
anchor,
|
|
1075
|
+
outOfFocus: outOfFocus_0
|
|
1076
|
+
} = t27;
|
|
1077
|
+
return /*#__PURE__*/_jsx("text", {
|
|
1078
|
+
x: x,
|
|
1079
|
+
y: y,
|
|
1080
|
+
dy: "0.32em",
|
|
1081
|
+
textAnchor: anchor,
|
|
1082
|
+
opacity: outOfFocus_0 ? dimOpacity : 1,
|
|
1083
|
+
"aria-hidden": true,
|
|
1084
|
+
strokeWidth: 3,
|
|
1085
|
+
paintOrder: "stroke",
|
|
1086
|
+
style: {
|
|
1087
|
+
stroke: chart.halo
|
|
1088
|
+
},
|
|
1089
|
+
className: clsx("fill-text tabular-nums", valueLabelSize === "xs" ? "text-xs" : "text-2xs"),
|
|
1090
|
+
children: text_4
|
|
1091
|
+
}, `label-${index_6}`);
|
|
962
1092
|
};
|
|
963
|
-
$[
|
|
964
|
-
$[
|
|
965
|
-
$[
|
|
966
|
-
$[
|
|
967
|
-
$[41] = rounded;
|
|
968
|
-
$[42] = rowColors;
|
|
969
|
-
$[43] = values;
|
|
970
|
-
$[44] = t23;
|
|
1093
|
+
$[57] = chart.halo;
|
|
1094
|
+
$[58] = dimOpacity;
|
|
1095
|
+
$[59] = valueLabelSize;
|
|
1096
|
+
$[60] = t26;
|
|
971
1097
|
} else {
|
|
972
|
-
|
|
1098
|
+
t26 = $[60];
|
|
973
1099
|
}
|
|
974
|
-
const
|
|
1100
|
+
const t27 = rowLabels.map(t26);
|
|
1101
|
+
const t28 = labeled && !horizontal && drawn.map((t29, i) => {
|
|
975
1102
|
const {
|
|
976
|
-
index:
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
const
|
|
1103
|
+
index: index_7,
|
|
1104
|
+
box: box_2,
|
|
1105
|
+
outOfFocus: outOfFocus_1,
|
|
1106
|
+
text: text_5
|
|
1107
|
+
} = t29;
|
|
1108
|
+
const center = Math.round(box_2.x + box_2.width / 2);
|
|
1109
|
+
const y_0 = box_2.y;
|
|
983
1110
|
const baseline = labelTops[i];
|
|
984
1111
|
return /*#__PURE__*/_jsxs("g", {
|
|
985
|
-
opacity:
|
|
1112
|
+
opacity: outOfFocus_1 ? dimOpacity : 1,
|
|
986
1113
|
"aria-hidden": true,
|
|
987
|
-
children: [baseline <
|
|
1114
|
+
children: [baseline < y_0 - LABEL_LIFT - 2 && /*#__PURE__*/_jsx("line", {
|
|
988
1115
|
x1: center + 0.5,
|
|
989
1116
|
x2: center + 0.5,
|
|
990
|
-
y1:
|
|
1117
|
+
y1: y_0 - 4,
|
|
991
1118
|
y2: baseline + 4,
|
|
992
1119
|
className: "stroke-border-strong"
|
|
993
1120
|
}), /*#__PURE__*/_jsx("text", {
|
|
@@ -1000,34 +1127,41 @@ export function ChartBar(t0) {
|
|
|
1000
1127
|
stroke: chart.halo
|
|
1001
1128
|
},
|
|
1002
1129
|
className: clsx("fill-text tabular-nums", valueLabelSize === "xs" ? "text-xs" : "text-2xs"),
|
|
1003
|
-
children:
|
|
1130
|
+
children: text_5
|
|
1004
1131
|
})]
|
|
1005
|
-
}, `label-${
|
|
1132
|
+
}, `label-${index_7}`);
|
|
1006
1133
|
});
|
|
1007
|
-
let
|
|
1008
|
-
if ($[
|
|
1009
|
-
|
|
1134
|
+
let t30;
|
|
1135
|
+
if ($[61] !== t27 || $[62] !== t28) {
|
|
1136
|
+
t30 = /*#__PURE__*/_jsxs("g", {
|
|
1010
1137
|
ref: labels,
|
|
1011
|
-
children:
|
|
1138
|
+
children: [t27, t28]
|
|
1012
1139
|
});
|
|
1013
|
-
$[
|
|
1014
|
-
$[
|
|
1140
|
+
$[61] = t27;
|
|
1141
|
+
$[62] = t28;
|
|
1142
|
+
$[63] = t30;
|
|
1015
1143
|
} else {
|
|
1016
|
-
|
|
1144
|
+
t30 = $[63];
|
|
1017
1145
|
}
|
|
1018
1146
|
return /*#__PURE__*/_jsxs("g", {
|
|
1019
1147
|
ref: ref,
|
|
1020
|
-
className:
|
|
1148
|
+
className: t22,
|
|
1021
1149
|
children: [/*#__PURE__*/_jsx("g", {
|
|
1022
|
-
className:
|
|
1023
|
-
style:
|
|
1024
|
-
children: drawn.map(
|
|
1025
|
-
}),
|
|
1150
|
+
className: t23,
|
|
1151
|
+
style: t24,
|
|
1152
|
+
children: drawn.map(t25)
|
|
1153
|
+
}), t30]
|
|
1026
1154
|
});
|
|
1027
1155
|
}
|
|
1028
|
-
function
|
|
1156
|
+
function _temp9(node) {
|
|
1029
1157
|
return [node.textContent ?? "", Math.ceil(node.getComputedTextLength())];
|
|
1030
1158
|
}
|
|
1159
|
+
function _temp8(sum, part_0) {
|
|
1160
|
+
return sum + part_0;
|
|
1161
|
+
}
|
|
1162
|
+
function _temp7(part) {
|
|
1163
|
+
return part !== null && part !== undefined;
|
|
1164
|
+
}
|
|
1031
1165
|
function _temp6() {
|
|
1032
1166
|
return new Map();
|
|
1033
1167
|
}
|