@oliasoft-open-source/charts-library 2.5.10 → 2.5.12

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oliasoft-open-source/charts-library",
3
- "version": "2.5.10",
3
+ "version": "2.5.12",
4
4
  "description": "React Chart Library (based on Chart.js and react-chart-js-2)",
5
5
  "main": "index.js",
6
6
  "files": [
package/release-notes.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Charts Library Release Notes
2
2
 
3
+ ## 2.5.12
4
+
5
+ - change thousand separators in axis label from comma to space
6
+
7
+ ## 2.5.11
8
+
9
+ - Allow headerComponent and chart title to coexist
10
+
3
11
  ## 2.5.10
4
12
 
5
13
  - Fix zoom / pan bug at < 0.1 scale on charts
@@ -37,7 +37,8 @@ const Controls = ({
37
37
  return (
38
38
  <>
39
39
  <div className={styles.controls}>
40
- {headerComponent || <Text bold>{chart.options.title}</Text>}
40
+ {!!chart.options.title && <Text bold>{chart.options.title}</Text>}
41
+ {headerComponent}
41
42
  <div className={styles.buttons}>
42
43
  {!showTable && (
43
44
  <>
@@ -43,6 +43,10 @@ const getLineChartAxis = (options, axisType, state, currentScales, i = 0) => {
43
43
  },
44
44
  }
45
45
  : {
46
+ callback(val) {
47
+ const value = this.getLabelForValue(val);
48
+ return value.replaceAll(/,/g, ' ');
49
+ },
46
50
  stepSize:
47
51
  axisData.stepSize ||
48
52
  (axisType === AxisType.Y ? additionalAxesOptions.stepSize : null),
@@ -2,6 +2,7 @@ import React, { useState } from 'react';
2
2
  import {
3
3
  Flex,
4
4
  Menu,
5
+ Select,
5
6
  Slider,
6
7
  Table,
7
8
  Text,
@@ -461,7 +462,7 @@ SquareAspectRatio.args = {
461
462
  },
462
463
  };
463
464
 
464
- export const HeaderComponent = (args) => {
465
+ export const HeaderComponentNoTitle = (args) => {
465
466
  const options = ['Category A', 'Category B', 'Category C'];
466
467
 
467
468
  const suboptions = ['Chart 1', 'Chart 2', 'Chart 3'];
@@ -482,7 +483,7 @@ export const HeaderComponent = (args) => {
482
483
 
483
484
  const chart = {
484
485
  ...basicChart,
485
- options: { ...basicChart.options, title: selectedChartTitle },
486
+ options: { ...basicChart.options, title: null },
486
487
  };
487
488
 
488
489
  return (
@@ -521,21 +522,53 @@ export const HeaderComponent = (args) => {
521
522
  />
522
523
  );
523
524
  };
525
+ HeaderComponentNoTitle.parameters = {
526
+ docs: {
527
+ description: {
528
+ story:
529
+ 'If no chart title is set, a `headerComponent` can take its place.',
530
+ },
531
+ },
532
+ };
524
533
 
525
- export const HeaderComponentFullWidth = Template.bind({});
526
- HeaderComponentFullWidth.args = {
527
- headerComponent: (
528
- <div style={{ flexGrow: 1, minWidth: 150 }}>
529
- <Slider max={100} min={0} onChange={() => {}} showArrows value={50} />
530
- </div>
531
- ),
534
+ const testComponent = (
535
+ <div
536
+ style={{
537
+ flexGrow: 1,
538
+ minWidth: 280,
539
+ margin: '-9px 0',
540
+ display: 'flex',
541
+ alignItems: 'center',
542
+ }}
543
+ >
544
+ <Select
545
+ options={['Aardvarks', 'Kangaroos']}
546
+ value="Aardvarks"
547
+ small
548
+ width="90px"
549
+ autoLayerWidth
550
+ />
551
+ <Slider max={100} min={0} onChange={() => {}} showArrows value={50} />
552
+ <Text>180s</Text>
553
+ </div>
554
+ );
555
+
556
+ export const HeaderComponentWithTitle = Template.bind({});
557
+ HeaderComponentWithTitle.args = {
558
+ headerComponent: testComponent,
559
+ };
560
+ HeaderComponentWithTitle.parameters = {
561
+ docs: {
562
+ description: {
563
+ story:
564
+ "If a chart title is set, the `headerComponent` will be displayed to the right of it. Setting a `minWidth` on the `headerComponent` will make sure it isn't squashed.",
565
+ },
566
+ },
532
567
  };
533
568
 
534
569
  export const SubheaderComponent = Template.bind({});
535
570
  SubheaderComponent.args = {
536
- subheaderComponent: (
537
- <Slider max={100} min={0} onChange={() => {}} showArrows value={50} />
538
- ),
571
+ subheaderComponent: testComponent,
539
572
  };
540
573
 
541
574
  const table = {
@@ -576,6 +609,14 @@ const table = {
576
609
  },
577
610
  ],
578
611
  };
612
+ SubheaderComponent.parameters = {
613
+ docs: {
614
+ description: {
615
+ story:
616
+ 'This will be displayed between the title/controls and the chart itself.',
617
+ },
618
+ },
619
+ };
579
620
 
580
621
  export const WithTable = (args) => {
581
622
  return <LineChart chart={basicChart} table={<Table table={table} />} />;