@oliasoft-open-source/charts-library 2.8.0 → 2.9.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oliasoft-open-source/charts-library",
3
- "version": "2.8.0",
3
+ "version": "2.9.0",
4
4
  "description": "React Chart Library (based on Chart.js and react-chart-js-2)",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/release-notes.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Charts Library Release Notes
2
2
 
3
+ ## 2.9.0
4
+
5
+ - Add double-click event on chart area, change reset chart ranges from one click to double click ([OW-10412](https://oliasoft.atlassian.net/browse/OW-10412))
6
+
3
7
  ## 2.8.0
4
8
 
5
9
  - Simplify dist-tag strategy for beta version releases (to reduce cleanup effort) ([OW-10003](https://oliasoft.atlassian.net/browse/OW-10003))
@@ -130,7 +130,7 @@ const AxesOptionsPopover = ({
130
130
  disabled={!isCustomValue}
131
131
  />
132
132
  <Text small muted>
133
- or click on canvas
133
+ or double click on canvas
134
134
  </Text>
135
135
  </Flex>
136
136
  </>
@@ -23,7 +23,7 @@ export const DragOptions = ({
23
23
  Hold shift to change axis
24
24
  </Text> */}
25
25
  <Text small muted>
26
- Click on canvas to reset
26
+ Double click on canvas to reset
27
27
  </Text>
28
28
  </Flex>
29
29
  ),
@@ -42,7 +42,7 @@ export const DragOptions = ({
42
42
  Hold shift to change axis
43
43
  </Text> */}
44
44
  <Text small muted>
45
- Click on canvas to reset
45
+ Double click on canvas to reset
46
46
  </Text>
47
47
  </Flex>
48
48
  ),
@@ -295,7 +295,8 @@ const LineChart = (props) => {
295
295
  chartInstance.update();
296
296
  };
297
297
 
298
- const onClick = (evt, elements, chartInstance) => {
298
+ const resetZoom = () => {
299
+ const chartInstance = chartRef.current;
299
300
  chartInstance.resetZoom();
300
301
  dispatch({ type: RESET_AXES_RANGES });
301
302
  };
@@ -459,7 +460,6 @@ const LineChart = (props) => {
459
460
  datasets: generatedDatasets,
460
461
  }}
461
462
  options={{
462
- onClick,
463
463
  onHover,
464
464
  maintainAspectRatio: chartStyling.maintainAspectRatio,
465
465
  aspectRatio: chartStyling.squareAspectRatio ? 1 : null, // 1 equals square aspect ratio
@@ -517,8 +517,27 @@ const LineChart = (props) => {
517
517
  borderColor: BORDER_COLOR,
518
518
  },
519
519
  },
520
+ events: [
521
+ 'mousemove',
522
+ 'mouseout',
523
+ 'click',
524
+ 'touchstart',
525
+ 'touchmove',
526
+ 'dblclick',
527
+ ],
520
528
  }}
521
- plugins={getPlugins(graph, legend, state)}
529
+ plugins={[
530
+ ...getPlugins(graph, legend, state),
531
+ {
532
+ id: 'customEventCatcher',
533
+ beforeEvent(chart, args, pluginOptions) {
534
+ const { event } = args;
535
+ if (event.type === 'dblclick') {
536
+ resetZoom();
537
+ }
538
+ },
539
+ },
540
+ ]}
522
541
  />
523
542
  </div>
524
543
  )}