@oliasoft-open-source/charts-library 7.0.0 → 7.0.1

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/index.js CHANGED
@@ -19020,6 +19020,7 @@ var MouseEvents = /* @__PURE__ */ function(MouseEvents) {
19020
19020
  MouseEvents["MOUSEUP"] = "mouseup";
19021
19021
  return MouseEvents;
19022
19022
  }({});
19023
+ /** Annotation shape identifiers. */
19023
19024
  var AnnotationType$1 = /* @__PURE__ */ function(AnnotationType) {
19024
19025
  AnnotationType["POINT"] = "point";
19025
19026
  AnnotationType["BOX"] = "box";
@@ -19028,6 +19029,7 @@ var AnnotationType$1 = /* @__PURE__ */ function(AnnotationType) {
19028
19029
  AnnotationType["LABEL"] = "label";
19029
19030
  return AnnotationType;
19030
19031
  }({});
19032
+ /** Allowed axes for annotation dragging. */
19031
19033
  var DragAxis = /* @__PURE__ */ function(DragAxis) {
19032
19034
  DragAxis["X"] = "x";
19033
19035
  DragAxis["Y"] = "y";
@@ -19036,6 +19038,7 @@ var DragAxis = /* @__PURE__ */ function(DragAxis) {
19036
19038
  }({});
19037
19039
  //#endregion
19038
19040
  //#region src/components/common/plugins/gradient-background-plugin/enums.ts
19041
+ /** Direction of the background gradient between chart-area edges or corners. */
19039
19042
  var GradientDirection = /* @__PURE__ */ function(GradientDirection) {
19040
19043
  GradientDirection[GradientDirection["TopToBottom"] = 0] = "TopToBottom";
19041
19044
  GradientDirection[GradientDirection["BottomToTop"] = 1] = "BottomToTop";
@@ -19049,11 +19052,13 @@ var GradientDirection = /* @__PURE__ */ function(GradientDirection) {
19049
19052
  }({});
19050
19053
  //#endregion
19051
19054
  //#region src/components/common/enums.ts
19055
+ /** Cartesian axis identifiers. */
19052
19056
  var AxisType = /* @__PURE__ */ function(AxisType) {
19053
19057
  AxisType["X"] = "x";
19054
19058
  AxisType["Y"] = "y";
19055
19059
  return AxisType;
19056
19060
  }({});
19061
+ /** Legend/layout positions. Individual options accept only the positions relevant to their layout. */
19057
19062
  var Position = /* @__PURE__ */ function(Position) {
19058
19063
  Position["Bottom"] = "bottom";
19059
19064
  Position["Top"] = "top";
@@ -19065,6 +19070,7 @@ var Position = /* @__PURE__ */ function(Position) {
19065
19070
  Position["BottomRight"] = "bottom-right";
19066
19071
  return Position;
19067
19072
  }({});
19073
+ /** Chart.js chart-kind identifiers used by the library. */
19068
19074
  var ChartType = /* @__PURE__ */ function(ChartType) {
19069
19075
  ChartType["LINE"] = "line";
19070
19076
  ChartType["BAR"] = "bar";
@@ -19073,6 +19079,7 @@ var ChartType = /* @__PURE__ */ function(ChartType) {
19073
19079
  ChartType["SCATTER"] = "scatter";
19074
19080
  return ChartType;
19075
19081
  }({});
19082
+ /** CSS cursors used during chart interactions. */
19076
19083
  var CursorStyle = /* @__PURE__ */ function(CursorStyle) {
19077
19084
  CursorStyle["Pointer"] = "pointer";
19078
19085
  CursorStyle["Initial"] = "initial";
@@ -19082,6 +19089,7 @@ var CursorStyle = /* @__PURE__ */ function(CursorStyle) {
19082
19089
  CursorStyle["Move"] = "move";
19083
19090
  return CursorStyle;
19084
19091
  }({});
19092
+ /** Chart.js scale-family identifiers. */
19085
19093
  var ScaleType = /* @__PURE__ */ function(ScaleType) {
19086
19094
  ScaleType["Category"] = "category";
19087
19095
  ScaleType["Linear"] = "linear";
@@ -19090,16 +19098,19 @@ var ScaleType = /* @__PURE__ */ function(ScaleType) {
19090
19098
  ScaleType["TimeSeries"] = "timeseries";
19091
19099
  return ScaleType;
19092
19100
  }({});
19101
+ /** Cartesian rendering orientation; this does not select LineChart tooltip content. */
19093
19102
  var ChartDirection = /* @__PURE__ */ function(ChartDirection) {
19094
19103
  ChartDirection["VERTICAL"] = "vertical";
19095
19104
  ChartDirection["HORIZONTAL"] = "horizontal";
19096
19105
  return ChartDirection;
19097
19106
  }({});
19107
+ /** Legacy tooltip label keys. */
19098
19108
  var TooltipLabel = /* @__PURE__ */ function(TooltipLabel) {
19099
19109
  TooltipLabel["Y"] = "yLabel";
19100
19110
  TooltipLabel["X"] = "xLabel";
19101
19111
  return TooltipLabel;
19102
19112
  }({});
19113
+ /** Alignment identifiers used by chart layout and legend options. */
19103
19114
  var AlignOptions = /* @__PURE__ */ function(AlignOptions) {
19104
19115
  AlignOptions["End"] = "end";
19105
19116
  AlignOptions["Start"] = "start";
@@ -19108,10 +19119,12 @@ var AlignOptions = /* @__PURE__ */ function(AlignOptions) {
19108
19119
  AlignOptions["Left"] = "left";
19109
19120
  return AlignOptions;
19110
19121
  }({});
19122
+ /** Legacy point classification identifiers. */
19111
19123
  var PointType = /* @__PURE__ */ function(PointType) {
19112
19124
  PointType["Casing"] = "casing";
19113
19125
  return PointType;
19114
19126
  }({});
19127
+ /** Annotation shape identifiers. */
19115
19128
  var AnnotationType = /* @__PURE__ */ function(AnnotationType) {
19116
19129
  AnnotationType["Box"] = "box";
19117
19130
  AnnotationType["Ellipse"] = "ellipse";
@@ -19120,6 +19133,7 @@ var AnnotationType = /* @__PURE__ */ function(AnnotationType) {
19120
19133
  AnnotationType["Label"] = "label";
19121
19134
  return AnnotationType;
19122
19135
  }({});
19136
+ /** Point marker shapes compatible with Chart.js. */
19123
19137
  var PointStyle = /* @__PURE__ */ function(PointStyle) {
19124
19138
  PointStyle["Circle"] = "circle";
19125
19139
  PointStyle["Square"] = "rect";
@@ -19127,10 +19141,12 @@ var PointStyle = /* @__PURE__ */ function(PointStyle) {
19127
19141
  PointStyle["Triangle"] = "triangle";
19128
19142
  return PointStyle;
19129
19143
  }({});
19144
+ /** Hover interaction modes used by the library. */
19130
19145
  var ChartHoverMode = /* @__PURE__ */ function(ChartHoverMode) {
19131
19146
  ChartHoverMode["Nearest"] = "nearest";
19132
19147
  return ChartHoverMode;
19133
19148
  }({});
19149
+ /** Interaction mode identifiers; availability depends on the chart controls. */
19134
19150
  var PanZoomMode = /* @__PURE__ */ function(PanZoomMode) {
19135
19151
  PanZoomMode["X"] = "x";
19136
19152
  PanZoomMode["Y"] = "y";
@@ -19138,10 +19154,12 @@ var PanZoomMode = /* @__PURE__ */ function(PanZoomMode) {
19138
19154
  PanZoomMode["Z"] = "z";
19139
19155
  return PanZoomMode;
19140
19156
  }({});
19157
+ /** Keyboard modifier identifiers used by chart interactions. */
19141
19158
  var Key = /* @__PURE__ */ function(Key) {
19142
19159
  Key["Shift"] = "Shift";
19143
19160
  return Key;
19144
19161
  }({});
19162
+ /** DOM event names used by chart interaction handlers. */
19145
19163
  var Events = /* @__PURE__ */ function(Events) {
19146
19164
  Events["Mousemove"] = "mousemove";
19147
19165
  Events["Mouseout"] = "mouseout";
@@ -19236,6 +19254,7 @@ var LOGARITHMIC_STEPS = [
19236
19254
  1e3,
19237
19255
  1e4
19238
19256
  ];
19257
+ /** Default categorical DS colour palette. Treat the exported array as read-only. */
19239
19258
  var COLORS = [
19240
19259
  "#3366cc",
19241
19260
  "#dc3912",
@@ -23290,16 +23309,19 @@ var calloutConnectorPlugin = {
23290
23309
  };
23291
23310
  //#endregion
23292
23311
  //#region src/components/line-chart/plugins/line-markers-plugin/types.ts
23312
+ /** Left/right attachment side for line markers. */
23293
23313
  var LineMarkerSide = /* @__PURE__ */ function(LineMarkerSide) {
23294
23314
  LineMarkerSide["Left"] = "left";
23295
23315
  LineMarkerSide["Right"] = "right";
23296
23316
  return LineMarkerSide;
23297
23317
  }({});
23318
+ /** Orientation of a line marker. */
23298
23319
  var LineMarkerDirection = /* @__PURE__ */ function(LineMarkerDirection) {
23299
23320
  LineMarkerDirection["Vertical"] = "vertical";
23300
23321
  LineMarkerDirection["Horizontal"] = "horizontal";
23301
23322
  return LineMarkerDirection;
23302
23323
  }({});
23324
+ /** Label placement relative to a line marker. */
23303
23325
  var LineMarkerLabelPosition = /* @__PURE__ */ function(LineMarkerLabelPosition) {
23304
23326
  LineMarkerLabelPosition["Left"] = "left";
23305
23327
  LineMarkerLabelPosition["Right"] = "right";
@@ -23308,6 +23330,7 @@ var LineMarkerLabelPosition = /* @__PURE__ */ function(LineMarkerLabelPosition)
23308
23330
  LineMarkerLabelPosition["OnLine"] = "onLine";
23309
23331
  return LineMarkerLabelPosition;
23310
23332
  }({});
23333
+ /** Horizontal alignment of marker label text. */
23311
23334
  var LineMarkerTextAlign = /* @__PURE__ */ function(LineMarkerTextAlign) {
23312
23335
  LineMarkerTextAlign["Left"] = "left";
23313
23336
  LineMarkerTextAlign["Right"] = "right";
@@ -24685,6 +24708,44 @@ var LineChart = (props) => {
24685
24708
  })]
24686
24709
  }, getChartKey(state, languageKey));
24687
24710
  };
24711
+ /**
24712
+ * Renders an interactive line chart with multiple axes, annotations, a legend and chart controls.
24713
+ *
24714
+ * Pass partial configuration through `chart`; omitted settings receive component defaults.
24715
+ * The example uses sample data, labels and a height of 320 pixels; these are not default values.
24716
+ *
24717
+ * @remarks
24718
+ * Defaults: bottom X axis, left Y axis, visible lines and points, bottom-left legend, and zoom enabled.
24719
+ * Pan, data labels, minor grid lines and annotations are disabled. No fixed width or height is assigned.
24720
+ * Performance mode is enabled by default, disabling animations.
24721
+ * The linked reference lists the complete normalized default configuration.
24722
+ *
24723
+ * @see https://gitlab.com/oliasoft-open-source/charts-library/-/blob/master/README.md#linechart
24724
+ *
24725
+ * @param props - Chart data and options, plus optional header, subheader and table content.
24726
+ * @returns The chart canvas and its associated UI.
24727
+ * @example
24728
+ * ```tsx
24729
+ * <LineChart chart={{
24730
+ * data: {
24731
+ * datasets: [{
24732
+ * label: 'DS A',
24733
+ * data: [{ x: 0, y: 10 }, { x: 1, y: 20 }, { x: 2, y: 15 }],
24734
+ * }],
24735
+ * },
24736
+ * options: {
24737
+ * axes: {
24738
+ * x: [{ label: 'X', position: 'bottom' }],
24739
+ * y: [{ label: 'Y', position: 'left' }],
24740
+ * },
24741
+ * chartStyling: { height: 320 },
24742
+ * legend: { display: true, position: 'bottom-left' },
24743
+ * graph: { lineTension: 0.01, showDataLabels: false },
24744
+ * chartOptions: { showLine: true, showPoints: true },
24745
+ * },
24746
+ * }} />
24747
+ * ```
24748
+ */
24688
24749
  var LineChartWithLegend = (props) => {
24689
24750
  const { options, data: { datasets = [] } = {} } = getDefaultProps$3(props);
24690
24751
  return /* @__PURE__ */ jsx(LegendProvider, {
@@ -24696,12 +24757,17 @@ var LineChartWithLegend = (props) => {
24696
24757
  //#endregion
24697
24758
  //#region src/components/line-chart/initialize/initialize-line-chart.ts
24698
24759
  /**
24699
- * Initialize the charts library with the provided configurations.
24700
- * This function will store the configuration options in a config object.
24701
- * @param {object} options - An object containing the configuration options for the library.
24702
- * @param {object} options.translations - The translations to be used in the library.
24703
- * @param {string} options.languageKey - The language key to be stored in the config object, used for translations.
24704
- * @param {...object} options - Any additional options to be stored in the config object.
24760
+ * Updates the shared chart configuration, including the language and translated control labels.
24761
+ *
24762
+ * Call during application setup before rendering charts. Configuration is shared across chart instances;
24763
+ * this is not a per-chart configuration API. Each call sets the language key (default `en`) and updates
24764
+ * the supplied configuration entries. Non-primitive entries other than translations are shallow-copied.
24765
+ *
24766
+ * @param options - Language key, translations and other shared configuration entries.
24767
+ * @example
24768
+ * ```ts
24769
+ * initializeLineChart({ languageKey: 'en' });
24770
+ * ```
24705
24771
  */
24706
24772
  var initializeLineChart = ({ languageKey = "en", ...options }) => {
24707
24773
  setConfig(INIT_KEYS.LANGUAGE_KEY, languageKey);
@@ -24931,11 +24997,6 @@ var usePieChartConfig = (chart) => {
24931
24997
  //#endregion
24932
24998
  //#region src/components/pie-chart/pie-chart.tsx
24933
24999
  Chart$1.register(LinearScale, CategoryScale, LogarithmicScale, ArcElement, plugin_legend, plugin_tooltip, plugin_title, index, plugin$1, plugin);
24934
- /**
24935
- * this is a pie chart component
24936
- * @param {props: IPieChartProps} IPieChartProps
24937
- * ./pie-chart.interface
24938
- */
24939
25000
  var PieChart = (props) => {
24940
25001
  setDefaultTheme();
24941
25002
  const chart = getDefaultProps$2(props);
@@ -24977,6 +25038,41 @@ var PieChart = (props) => {
24977
25038
  })
24978
25039
  });
24979
25040
  };
25041
+ /**
25042
+ * Renders pie segments with optional data labels, a legend and an inner cutout.
25043
+ *
25044
+ * Pass partial configuration through `chart`; omitted settings receive component defaults.
25045
+ * The example uses sample data, labels and a height of 320 pixels; these are not default values.
25046
+ *
25047
+ * @remarks
25048
+ * Defaults: a full pie (cutout 0), a bottom legend, and no fixed width or height.
25049
+ * Data labels, stacking, zoom and pan are disabled. Pie charts do not have Cartesian axes.
25050
+ * Performance mode is enabled by default, disabling animations.
25051
+ * The linked reference lists the complete normalized default configuration.
25052
+ *
25053
+ * @see https://gitlab.com/oliasoft-open-source/charts-library/-/blob/master/README.md#piechart
25054
+ *
25055
+ * @param props - Chart data and options.
25056
+ * @returns The chart canvas and its associated UI.
25057
+ * @example
25058
+ * ```tsx
25059
+ * <PieChart chart={{
25060
+ * data: {
25061
+ * labels: ['A', 'B', 'C'],
25062
+ * datasets: [{
25063
+ * label: 'DS A',
25064
+ * data: [10, 20, 15],
25065
+ * backgroundColor: ['#3366cc', '#dc3912', '#ff9900'],
25066
+ * }],
25067
+ * },
25068
+ * options: {
25069
+ * chartStyling: { height: 320 },
25070
+ * legend: { display: true, position: 'bottom' },
25071
+ * graph: { cutout: 0, showDataLabels: false },
25072
+ * },
25073
+ * }} />
25074
+ * ```
25075
+ */
24980
25076
  var PieChartWithLegend = (props) => {
24981
25077
  const { options } = getDefaultProps$2(props);
24982
25078
  return /* @__PURE__ */ jsx(LegendProvider, {
@@ -39334,6 +39430,45 @@ var BarChart = (props) => {
39334
39430
  })]
39335
39431
  }, languageKey);
39336
39432
  };
39433
+ /**
39434
+ * Renders vertical or horizontal bars with optional stacking, annotations and a legend.
39435
+ *
39436
+ * Pass partial configuration through `chart`; omitted settings receive component defaults.
39437
+ * The example uses sample data, labels and a height of 320 pixels; these are not default values.
39438
+ *
39439
+ * @remarks
39440
+ * Defaults: vertical bars, a top-left legend, zero included in automatic scale bounds, and annotations enabled.
39441
+ * Zoom, pan, stacking and data labels are disabled. No fixed width or height is assigned.
39442
+ * Performance mode is enabled by default, disabling animations.
39443
+ * The linked reference lists the complete normalized default configuration.
39444
+ *
39445
+ * @see https://gitlab.com/oliasoft-open-source/charts-library/-/blob/master/README.md#barchart
39446
+ *
39447
+ * @param props - Chart data and options.
39448
+ * @returns The chart canvas and its associated UI.
39449
+ * @example
39450
+ * ```tsx
39451
+ * <BarChart chart={{
39452
+ * data: {
39453
+ * labels: ['A', 'B', 'C'],
39454
+ * datasets: [{
39455
+ * label: 'DS A',
39456
+ * data: [{ x: 'A', y: 10 }, { x: 'B', y: 20 }, { x: 'C', y: 15 }],
39457
+ * }],
39458
+ * },
39459
+ * options: {
39460
+ * direction: 'vertical',
39461
+ * axes: {
39462
+ * x: [{ label: 'Category', position: 'bottom' }],
39463
+ * y: [{ label: 'Value', position: 'left' }],
39464
+ * },
39465
+ * chartStyling: { height: 320 },
39466
+ * legend: { display: true, position: 'top-left' },
39467
+ * graph: { showDataLabels: false },
39468
+ * },
39469
+ * }} />
39470
+ * ```
39471
+ */
39337
39472
  var BarChartWithLegend = (props) => {
39338
39473
  const { options } = getDefaultProps$1(props);
39339
39474
  return /* @__PURE__ */ jsx(LegendProvider, {
@@ -39732,6 +39867,43 @@ var ScatterChart = (props) => {
39732
39867
  })
39733
39868
  });
39734
39869
  };
39870
+ /**
39871
+ * Renders Cartesian points with a legend, optional annotations and a background gradient.
39872
+ *
39873
+ * Pass partial configuration through `chart`; omitted settings receive component defaults.
39874
+ * The example uses sample data, labels and a height of 320 pixels; these are not default values.
39875
+ *
39876
+ * @remarks
39877
+ * Defaults: automatic width and height, a bottom-left legend, zero included in automatic scale bounds,
39878
+ * and annotations enabled. Zoom, pan, data labels, minor grid lines and the background gradient are disabled.
39879
+ * Performance mode is enabled by default, disabling animations.
39880
+ * The linked reference lists the complete normalized default configuration.
39881
+ *
39882
+ * @see https://gitlab.com/oliasoft-open-source/charts-library/-/blob/master/README.md#scatterchart
39883
+ *
39884
+ * @param props - Chart data and options.
39885
+ * @returns The chart canvas and its associated UI.
39886
+ * @example
39887
+ * ```tsx
39888
+ * <ScatterChart chart={{
39889
+ * data: {
39890
+ * datasets: [{
39891
+ * label: 'DS A',
39892
+ * data: [{ x: 1, y: 10 }, { x: 2, y: 20 }, { x: 3, y: 15 }],
39893
+ * }],
39894
+ * },
39895
+ * options: {
39896
+ * axes: {
39897
+ * x: [{ label: 'X', position: 'bottom' }],
39898
+ * y: [{ label: 'Y', position: 'left' }],
39899
+ * },
39900
+ * chartStyling: { height: 320 },
39901
+ * legend: { display: true, position: 'bottom-left' },
39902
+ * graph: { showDataLabels: false, showMinorGridlines: false },
39903
+ * },
39904
+ * }} />
39905
+ * ```
39906
+ */
39735
39907
  var ScatterChartWithLegend = (props) => {
39736
39908
  const { options } = getDefaultProps(props);
39737
39909
  return /* @__PURE__ */ jsx(LegendProvider, {
@@ -39743,6 +39915,17 @@ var ScatterChartWithLegend = (props) => {
39743
39915
  //#region src/components/common/helpers/get-grouped-color-scheme/get-grouped-color-scheme.ts
39744
39916
  extend([lchPlugin]);
39745
39917
  var MIN_LIGHTNESS = 15;
39918
+ /**
39919
+ * Builds a darkest-first palette by varying LCH lightness while retaining the starting hue and chroma.
39920
+ *
39921
+ * @param length - Requested number of colours. Use a non-negative integer; zero returns an empty array.
39922
+ * @param startingColor - Colour understood by colord. A length of one returns this string unchanged.
39923
+ * @returns CSS LCH colour strings, except for the unchanged single-colour case.
39924
+ * @example
39925
+ * ```ts
39926
+ * const colors = getGroupedColorScheme(3, '#3366cc');
39927
+ * ```
39928
+ */
39746
39929
  var getGroupedColorScheme = (length, startingColor) => {
39747
39930
  if (length === 1) return [startingColor];
39748
39931
  const { h: hue, c: chroma } = colord(startingColor).toLch();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oliasoft-open-source/charts-library",
3
- "version": "7.0.0",
3
+ "version": "7.0.1",
4
4
  "description": "React Chart Library (based on Chart.js and react-chart-js-2)",
5
5
  "homepage": "https://gitlab.com/oliasoft-open-source/charts-library",
6
6
  "bugs": {