From 6a472f32ba41534462903b8f5c57f68ad32b435d Mon Sep 17 00:00:00 2001 From: Coltin Kifer Date: Mon, 2 Dec 2024 21:12:26 +0000 Subject: [PATCH] feat: upgrade recharts, add new event handler props on categorical charts --- package-lock.json | 14 +++++++------- package.json | 2 +- src/docs/api/AreaChart.js | 18 +++++++++++++++++- src/docs/api/BarChart.js | 16 ++++++++++++++++ src/docs/api/ComposedChart.js | 18 +++++++++++++++++- src/docs/api/FunnelChart.js | 16 ++++++++++++++++ src/docs/api/LineChart.js | 18 +++++++++++++++++- src/docs/api/PieChart.js | 16 ++++++++++++++++ src/docs/api/RadarChart.js | 21 ++++++++++++++++++++- src/docs/api/RadialBarChart.js | 16 ++++++++++++++++ src/docs/api/ScatterChart.js | 16 ++++++++++++++++ 11 files changed, 159 insertions(+), 12 deletions(-) diff --git a/package-lock.json b/package-lock.json index cfc145d9..9a89108b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -30,7 +30,7 @@ "react-router-redux": "~4.0.7", "react-router-scroll": "~0.4.1", "react-runner": "^1.0.3", - "recharts": "^2.13.3", + "recharts": "^2.14.0", "redux": "4.0.0", "redux-thunk": "^2.3.0", "rimraf": "^2.5.4", @@ -5912,9 +5912,9 @@ } }, "node_modules/recharts": { - "version": "2.13.3", - "resolved": "https://registry.npmjs.org/recharts/-/recharts-2.13.3.tgz", - "integrity": "sha512-YDZ9dOfK9t3ycwxgKbrnDlRC4BHdjlY73fet3a0C1+qGMjXVZe6+VXmpOIIhzkje5MMEL8AN4hLIe4AMskBzlA==", + "version": "2.14.0", + "resolved": "https://registry.npmjs.org/recharts/-/recharts-2.14.0.tgz", + "integrity": "sha512-kgDvDdNOh/gHQ4Q8hu7VrLNKs/bP/meG/XaRnsQG+Yp4PxugfPvaRFC0m4q7RWdlw0HxIkTSdcsGrsVQsg2qTA==", "dependencies": { "clsx": "^2.0.0", "eventemitter3": "^4.0.1", @@ -11332,9 +11332,9 @@ } }, "recharts": { - "version": "2.13.3", - "resolved": "https://registry.npmjs.org/recharts/-/recharts-2.13.3.tgz", - "integrity": "sha512-YDZ9dOfK9t3ycwxgKbrnDlRC4BHdjlY73fet3a0C1+qGMjXVZe6+VXmpOIIhzkje5MMEL8AN4hLIe4AMskBzlA==", + "version": "2.14.0", + "resolved": "https://registry.npmjs.org/recharts/-/recharts-2.14.0.tgz", + "integrity": "sha512-kgDvDdNOh/gHQ4Q8hu7VrLNKs/bP/meG/XaRnsQG+Yp4PxugfPvaRFC0m4q7RWdlw0HxIkTSdcsGrsVQsg2qTA==", "requires": { "clsx": "^2.0.0", "eventemitter3": "^4.0.1", diff --git a/package.json b/package.json index 26c57207..8bea0a41 100644 --- a/package.json +++ b/package.json @@ -62,7 +62,7 @@ "react-router-redux": "~4.0.7", "react-router-scroll": "~0.4.1", "react-runner": "^1.0.3", - "recharts": "^2.13.3", + "recharts": "^2.14.0", "redux": "4.0.0", "redux-thunk": "^2.3.0", "rimraf": "^2.5.4", diff --git a/src/docs/api/AreaChart.js b/src/docs/api/AreaChart.js index a76bc585..b4b89253 100644 --- a/src/docs/api/AreaChart.js +++ b/src/docs/api/AreaChart.js @@ -39,7 +39,7 @@ export default { isOptional: true, desc: { 'en-US': - "When syncId is provided, allows customisation of how the charts will synchronize tooltips and brushes. Using 'index' (default setting), other charts will reuse current datum's index within the data array. In cases where data does not have the same length, this might yield unexpected results. In that case use 'value' which will try to match other charts values, or a fully custom function which will receive tick, data as argument and should return an index." + "When syncId is provided, allows customisation of how the charts will synchronize tooltips and brushes. Using 'index' (default setting), other charts will reuse current datum's index within the data array. In cases where data does not have the same length, this might yield unexpected results. In that case use 'value' which will try to match other charts values, or a fully custom function which will receive tick, data as argument and should return an index.", }, }, { @@ -152,6 +152,22 @@ export default { 'zh-CN': '鼠标在图表图形区域 mouseleave 事件的回调函数。', }, }, + { + name: 'onDoubleClick', + type: 'Function', + isOptional: true, + desc: { + 'en-US': 'The customized event handler of dblclick in this chart.', + }, + }, + { + name: 'onContextMenu', + type: 'Function', + isOptional: true, + desc: { + 'en-US': 'The customized event handler of contextmenu in this chart.', + }, + }, ], parentComponents: ['ResponsiveContainer'], childrenComponents: [ diff --git a/src/docs/api/BarChart.js b/src/docs/api/BarChart.js index 29a0068d..2b2afeb5 100644 --- a/src/docs/api/BarChart.js +++ b/src/docs/api/BarChart.js @@ -203,6 +203,22 @@ export default { 'zh-CN': '鼠标在图表图形区域 mouseleave 事件的回调函数。', }, }, + { + name: 'onDoubleClick', + type: 'Function', + isOptional: true, + desc: { + 'en-US': 'The customized event handler of dblclick in this chart.', + }, + }, + { + name: 'onContextMenu', + type: 'Function', + isOptional: true, + desc: { + 'en-US': 'The customized event handler of contextmenu in this chart.', + }, + }, ], parentComponents: ['ResponsiveContainer'], childrenComponents: [ diff --git a/src/docs/api/ComposedChart.js b/src/docs/api/ComposedChart.js index cafe1adf..0c219550 100644 --- a/src/docs/api/ComposedChart.js +++ b/src/docs/api/ComposedChart.js @@ -37,7 +37,7 @@ export default { isOptional: true, desc: { 'en-US': - "When syncId is provided, allows customisation of how the charts will synchronize tooltips and brushes. Using 'index' (default setting), other charts will reuse current datum's index within the data array. In cases where data does not have the same length, this might yield unexpected results. In that case use 'value' which will try to match other charts values, or a fully custom function which will receive tick, data as argument and should return an index." + "When syncId is provided, allows customisation of how the charts will synchronize tooltips and brushes. Using 'index' (default setting), other charts will reuse current datum's index within the data array. In cases where data does not have the same length, this might yield unexpected results. In that case use 'value' which will try to match other charts values, or a fully custom function which will receive tick, data as argument and should return an index.", }, }, { @@ -172,6 +172,22 @@ export default { 'zh-CN': '鼠标在图表图形区域 mouseleave 事件的回调函数。', }, }, + { + name: 'onDoubleClick', + type: 'Function', + isOptional: true, + desc: { + 'en-US': 'The customized event handler of dblclick in this chart.', + }, + }, + { + name: 'onContextMenu', + type: 'Function', + isOptional: true, + desc: { + 'en-US': 'The customized event handler of contextmenu in this chart.', + }, + }, ], parentComponents: ['ResponsiveContainer'], childrenComponents: [ diff --git a/src/docs/api/FunnelChart.js b/src/docs/api/FunnelChart.js index 62d4d731..def6ebb2 100644 --- a/src/docs/api/FunnelChart.js +++ b/src/docs/api/FunnelChart.js @@ -78,6 +78,22 @@ export default { 'zh-CN': '鼠标在图表图形区域 mouseleave 事件的回调函数。', }, }, + { + name: 'onDoubleClick', + type: 'Function', + isOptional: true, + desc: { + 'en-US': 'The customized event handler of dblclick in this chart.', + }, + }, + { + name: 'onContextMenu', + type: 'Function', + isOptional: true, + desc: { + 'en-US': 'The customized event handler of contextmenu in this chart.', + }, + }, ], parentComponents: ['ResponsiveContainer'], childrenComponents: ['Funnel', 'Legend', 'Tooltip', 'Customized', 'validate svg elements...'], diff --git a/src/docs/api/LineChart.js b/src/docs/api/LineChart.js index 9810eb87..5b60c2be 100644 --- a/src/docs/api/LineChart.js +++ b/src/docs/api/LineChart.js @@ -35,7 +35,7 @@ export default { isOptional: true, desc: { 'en-US': - "When syncId is provided, allows customisation of how the charts will synchronize tooltips and brushes. Using 'index' (default setting), other charts will reuse current datum's index within the data array. In cases where data does not have the same length, this might yield unexpected results. In that case use 'value' which will try to match other charts values, or a fully custom function which will receive tick, data as argument and should return an index." + "When syncId is provided, allows customization of how the charts will synchronize tooltips and brushes. Using 'index' (default setting), other charts will reuse current datum's index within the data array. In cases where data does not have the same length, this might yield unexpected results. In that case use 'value' which will try to match other charts values, or a fully custom function which will receive tick, data as argument and should return an index.", }, }, { @@ -116,6 +116,22 @@ export default { 'zh-CN': '鼠标在图表图形区域 mouseleave 事件的回调函数。', }, }, + { + name: 'onDoubleClick', + type: 'Function', + isOptional: true, + desc: { + 'en-US': 'The customized event handler of dblclick in this chart.', + }, + }, + { + name: 'onContextMenu', + type: 'Function', + isOptional: true, + desc: { + 'en-US': 'The customized event handler of contextmenu in this chart.', + }, + }, ], parentComponents: ['ResponsiveContainer'], childrenComponents: [ diff --git a/src/docs/api/PieChart.js b/src/docs/api/PieChart.js index 0717373b..f1bc7dc3 100644 --- a/src/docs/api/PieChart.js +++ b/src/docs/api/PieChart.js @@ -65,6 +65,22 @@ export default { '饼图每个楔子的 mouseleave 事件的回调函数,如果当子组件 Pie 上也绑定了同样的事件,子组件的事件回调函数才会被绑定。', }, }, + { + name: 'onDoubleClick', + type: 'Function', + isOptional: true, + desc: { + 'en-US': 'The customized event handler of dblclick in this chart.', + }, + }, + { + name: 'onContextMenu', + type: 'Function', + isOptional: true, + desc: { + 'en-US': 'The customized event handler of contextmenu in this chart.', + }, + }, ], parentComponents: ['ResponsiveContainer'], childrenComponents: [ diff --git a/src/docs/api/RadarChart.js b/src/docs/api/RadarChart.js index 218e0f44..d9dde6d9 100644 --- a/src/docs/api/RadarChart.js +++ b/src/docs/api/RadarChart.js @@ -30,7 +30,10 @@ export default { 'en-US': 'The source data, in which each element is an object.', 'zh-CN': '输入数据,现在支持的类型是对象数组。', }, - format: ["[{ 'subject': 'a', 'key': 120, 'fullMark': 150 }]", "[{ 'subject': 'a', 'key': 100, 'secondKey': 50, 'fullMark': 150 }]"], + format: [ + "[{ 'subject': 'a', 'key': 120, 'fullMark': 150 }]", + "[{ 'subject': 'a', 'key': 100, 'secondKey': 50, 'fullMark': 150 }]", + ], }, { name: 'cx', @@ -152,6 +155,22 @@ export default { 'zh-CN': '雷达图 click 事件的回调函数。', }, }, + { + name: 'onDoubleClick', + type: 'Function', + isOptional: true, + desc: { + 'en-US': 'The customized event handler of dblclick in this chart.', + }, + }, + { + name: 'onContextMenu', + type: 'Function', + isOptional: true, + desc: { + 'en-US': 'The customized event handler of contextmenu in this chart.', + }, + }, ], parentComponents: ['ResponsiveContainer'], childrenComponents: [ diff --git a/src/docs/api/RadialBarChart.js b/src/docs/api/RadialBarChart.js index 10867ae3..9171e182 100644 --- a/src/docs/api/RadialBarChart.js +++ b/src/docs/api/RadialBarChart.js @@ -171,6 +171,22 @@ export default { '每个柱条的 click 事件的回调函数,如果当子组件 RadialBar 上也绑定了同样的事件,子组件的事件回调函数才会被绑定。', }, }, + { + name: 'onDoubleClick', + type: 'Function', + isOptional: true, + desc: { + 'en-US': 'The customized event handler of dblclick in this chart.', + }, + }, + { + name: 'onContextMenu', + type: 'Function', + isOptional: true, + desc: { + 'en-US': 'The customized event handler of contextmenu in this chart.', + }, + }, ], parentComponents: ['ResponsiveContainer'], childrenComponents: [ diff --git a/src/docs/api/ScatterChart.js b/src/docs/api/ScatterChart.js index 8dc7cb65..7bbedea9 100644 --- a/src/docs/api/ScatterChart.js +++ b/src/docs/api/ScatterChart.js @@ -104,6 +104,22 @@ export default { 'zh-CN': '鼠标在图表图形区域 mouseleave 事件的回调函数。', }, }, + { + name: 'onDoubleClick', + type: 'Function', + isOptional: true, + desc: { + 'en-US': 'The customized event handler of dblclick in this chart.', + }, + }, + { + name: 'onContextMenu', + type: 'Function', + isOptional: true, + desc: { + 'en-US': 'The customized event handler of contextmenu in this chart.', + }, + }, ], parentComponents: ['ResponsiveContainer'], childrenComponents: [