From 6876707417f65eec0562a338ce67ba0b8cc4390f Mon Sep 17 00:00:00 2001 From: "linghao.su" Date: Wed, 28 Jun 2023 22:46:45 +0800 Subject: [PATCH 1/3] feat(pie): add angleRange for control pie range --- src/chart/pie/PieSeries.ts | 2 + src/chart/pie/pieLayout.ts | 8 ++- test/pie-endAngle.html | 99 ++++++++++++++++++++++++++ test/runTest/actions/__meta__.json | 1 + test/runTest/actions/pie-endAngle.json | 1 + 5 files changed, 108 insertions(+), 3 deletions(-) create mode 100644 test/pie-endAngle.html create mode 100644 test/runTest/actions/pie-endAngle.json diff --git a/src/chart/pie/PieSeries.ts b/src/chart/pie/PieSeries.ts index ed427bfff0..3cb5a8fffd 100644 --- a/src/chart/pie/PieSeries.ts +++ b/src/chart/pie/PieSeries.ts @@ -112,6 +112,7 @@ export interface PieSeriesOption extends clockwise?: boolean startAngle?: number + angleRange?: number minAngle?: number minShowLabelAngle?: number @@ -217,6 +218,7 @@ class PieSeriesModel extends SeriesModel { // 默认顺时针 clockwise: true, startAngle: 90, + angleRange: 360, // 最小角度改为0 minAngle: 0, diff --git a/src/chart/pie/pieLayout.ts b/src/chart/pie/pieLayout.ts index c5c52ccfcd..171bb3df8a 100644 --- a/src/chart/pie/pieLayout.ts +++ b/src/chart/pie/pieLayout.ts @@ -93,6 +93,8 @@ export default function pieLayout( const startAngle = -seriesModel.get('startAngle') * RADIAN; + const angleRange = seriesModel.get('angleRange') * RADIAN || PI2; + const minAngle = seriesModel.get('minAngle') * RADIAN; let validDataCount = 0; @@ -114,7 +116,7 @@ export default function pieLayout( extent[0] = 0; // In the case some sector angle is smaller than minAngle - let restAngle = PI2; + let restAngle = angleRange; let valueSumLargerThanMinAngle = 0; let currentAngle = startAngle; @@ -146,7 +148,7 @@ export default function pieLayout( ? unitRadian : (value * unitRadian); } else { - angle = PI2 / validDataCount; + angle = angleRange / validDataCount; } if (angle < minAngle) { @@ -180,7 +182,7 @@ export default function pieLayout( // Average the angle if rest angle is not enough after all angles is // Constrained by minAngle if (restAngle <= 1e-3) { - const angle = PI2 / validDataCount; + const angle = angleRange / validDataCount; data.each(valueDim, function (value: number, idx: number) { if (!isNaN(value)) { const layout = data.getItemLayout(idx); diff --git a/test/pie-endAngle.html b/test/pie-endAngle.html new file mode 100644 index 0000000000..95000d97f1 --- /dev/null +++ b/test/pie-endAngle.html @@ -0,0 +1,99 @@ + + + + + + + + + + + + + + + + + +
+
+
+
+ + + + + + \ No newline at end of file diff --git a/test/runTest/actions/__meta__.json b/test/runTest/actions/__meta__.json index dee65260b6..306775fc32 100644 --- a/test/runTest/actions/__meta__.json +++ b/test/runTest/actions/__meta__.json @@ -155,6 +155,7 @@ "pie-animation": 2, "pie-calculable": 1, "pie-cornerRadius": 1, + "pie-endAngle": 1, "pie-label": 2, "pie-label-extreme": 2, "pie-percent": 2, diff --git a/test/runTest/actions/pie-endAngle.json b/test/runTest/actions/pie-endAngle.json new file mode 100644 index 0000000000..bd226911b9 --- /dev/null +++ b/test/runTest/actions/pie-endAngle.json @@ -0,0 +1 @@ +[{"name":"Action 1","ops":[{"type":"mousemove","time":222,"x":515,"y":550},{"type":"mousemove","time":423,"x":697,"y":31},{"type":"mousemove","time":631,"x":705,"y":28},{"type":"mousemove","time":833,"x":750,"y":65},{"type":"mousemove","time":1037,"x":710,"y":74},{"type":"mousemove","time":1237,"x":685,"y":72},{"type":"mousemove","time":1439,"x":681,"y":72},{"type":"mousemove","time":1686,"x":681,"y":71},{"type":"mousemove","time":1889,"x":676,"y":66},{"type":"mousemove","time":2095,"x":635,"y":34},{"type":"mousemove","time":2295,"x":635,"y":41},{"type":"mousemove","time":2506,"x":635,"y":43},{"type":"mousemove","time":2715,"x":636,"y":43},{"type":"screenshot","time":3650},{"type":"screenshot","time":4908},{"type":"mousedown","time":5359,"x":636,"y":43},{"type":"mousemove","time":5588,"x":637,"y":43},{"type":"mousemove","time":5789,"x":673,"y":42},{"type":"mousemove","time":5989,"x":678,"y":42},{"type":"mousemove","time":6747,"x":679,"y":42},{"type":"mousemove","time":6950,"x":685,"y":42},{"type":"mouseup","time":7116,"x":685,"y":42},{"time":7117,"delay":400,"type":"screenshot-auto"},{"type":"screenshot","time":7714},{"type":"mousedown","time":8142,"x":685,"y":42},{"type":"mousemove","time":8338,"x":685,"y":42},{"type":"mousemove","time":8541,"x":703,"y":41},{"type":"mouseup","time":8675,"x":708,"y":41},{"time":8676,"delay":400,"type":"screenshot-auto"},{"type":"mousemove","time":8749,"x":708,"y":41},{"type":"screenshot","time":9425},{"type":"mousemove","time":9553,"x":707,"y":42},{"type":"mousemove","time":9753,"x":679,"y":67},{"type":"mousemove","time":9956,"x":678,"y":69},{"type":"mousemove","time":10163,"x":679,"y":70},{"type":"mousedown","time":10317,"x":679,"y":70},{"type":"mousemove","time":10520,"x":678,"y":70},{"type":"mousemove","time":10720,"x":668,"y":70},{"type":"mousemove","time":10921,"x":660,"y":72},{"type":"mousemove","time":11121,"x":656,"y":74},{"type":"mouseup","time":11142,"x":656,"y":74},{"time":11143,"delay":400,"type":"screenshot-auto"},{"type":"screenshot","time":11808},{"type":"mousedown","time":12542,"x":656,"y":74},{"type":"mousemove","time":12779,"x":656,"y":74},{"type":"mousemove","time":12979,"x":676,"y":74},{"type":"mousemove","time":13181,"x":679,"y":74},{"type":"mousemove","time":13392,"x":679,"y":74},{"type":"mousemove","time":13412,"x":680,"y":74},{"type":"mousemove","time":13615,"x":681,"y":74},{"type":"mouseup","time":14050,"x":681,"y":74},{"time":14051,"delay":400,"type":"screenshot-auto"},{"type":"mousemove","time":14055,"x":681,"y":74},{"type":"screenshot","time":14434},{"type":"mousemove","time":14929,"x":681,"y":74},{"type":"mousemove","time":15131,"x":680,"y":92},{"type":"mousemove","time":15337,"x":679,"y":95},{"type":"mousedown","time":15350,"x":679,"y":95},{"type":"mousemove","time":15578,"x":679,"y":95},{"type":"mousemove","time":15779,"x":659,"y":98},{"type":"mousemove","time":15983,"x":643,"y":102},{"type":"mouseup","time":16167,"x":628,"y":105},{"time":16168,"delay":400,"type":"screenshot-auto"},{"type":"mousemove","time":16190,"x":628,"y":105},{"type":"screenshot","time":17140},{"type":"mousemove","time":17153,"x":628,"y":104},{"type":"mousemove","time":17354,"x":631,"y":102},{"type":"mousemove","time":17555,"x":631,"y":102},{"type":"mousemove","time":17755,"x":640,"y":95},{"type":"mousemove","time":17958,"x":643,"y":94},{"type":"mousedown","time":18257,"x":643,"y":94},{"type":"mousemove","time":18454,"x":644,"y":94},{"type":"mousemove","time":18656,"x":665,"y":94},{"type":"mouseup","time":18816,"x":665,"y":94},{"time":18817,"delay":400,"type":"screenshot-auto"},{"type":"mousemove","time":18820,"x":666,"y":94},{"type":"screenshot","time":19499},{"type":"mousemove","time":20054,"x":667,"y":94},{"type":"mousemove","time":20255,"x":676,"y":94},{"type":"mousemove","time":20371,"x":676,"y":94},{"type":"mousemove","time":20573,"x":717,"y":95},{"type":"mousedown","time":20784,"x":717,"y":95},{"type":"mouseup","time":20924,"x":717,"y":95},{"time":20925,"delay":400,"type":"screenshot-auto"},{"type":"screenshot","time":21372},{"type":"mousemove","time":21654,"x":717,"y":95},{"type":"mousemove","time":21855,"x":675,"y":100},{"type":"mousemove","time":22058,"x":668,"y":102},{"type":"mousemove","time":22261,"x":656,"y":101},{"type":"mousedown","time":22332,"x":656,"y":101},{"type":"mousemove","time":22462,"x":656,"y":101},{"type":"mouseup","time":22491,"x":656,"y":101},{"time":22492,"delay":400,"type":"screenshot-auto"},{"type":"screenshot","time":23440},{"type":"mousemove","time":23680,"x":655,"y":101},{"type":"mousemove","time":23881,"x":640,"y":97},{"type":"mousemove","time":24089,"x":640,"y":97},{"type":"mousedown","time":24250,"x":640,"y":97},{"type":"mouseup","time":24382,"x":640,"y":97},{"time":24383,"delay":400,"type":"screenshot-auto"},{"type":"screenshot","time":25224},{"type":"mousemove","time":26387,"x":640,"y":96},{"type":"mousemove","time":26589,"x":657,"y":71},{"type":"mousemove","time":26795,"x":660,"y":40},{"type":"mousemove","time":26996,"x":658,"y":33},{"type":"mousemove","time":27196,"x":653,"y":22},{"type":"mousedown","time":27340,"x":651,"y":19},{"type":"mousemove","time":27397,"x":651,"y":19},{"type":"mouseup","time":27439,"x":651,"y":19},{"time":27440,"delay":400,"type":"screenshot-auto"},{"type":"screenshot","time":28459},{"type":"mousemove","time":28736,"x":651,"y":20},{"type":"mousemove","time":28937,"x":663,"y":42},{"type":"mousedown","time":29133,"x":663,"y":43},{"type":"mousemove","time":29144,"x":663,"y":43},{"type":"mouseup","time":29266,"x":663,"y":43},{"time":29267,"delay":400,"type":"screenshot-auto"},{"type":"screenshot","time":30085},{"type":"mousemove","time":30178,"x":663,"y":42},{"type":"mousemove","time":30381,"x":670,"y":40},{"type":"mousemove","time":30586,"x":693,"y":67},{"type":"mousemove","time":30789,"x":693,"y":69},{"type":"mousemove","time":30994,"x":697,"y":51},{"type":"mousemove","time":31194,"x":696,"y":47},{"type":"mousedown","time":31388,"x":710,"y":39},{"type":"mousemove","time":31403,"x":710,"y":39},{"type":"mouseup","time":31494,"x":710,"y":39},{"time":31495,"delay":400,"type":"screenshot-auto"},{"type":"screenshot","time":32331},{"type":"mousemove","time":32396,"x":713,"y":39},{"type":"mousemove","time":32598,"x":796,"y":57}],"scrollY":0,"scrollX":0,"timestamp":1687962537508}] \ No newline at end of file From 56138eea82e2b662ee8788995b258e3b6d95323e Mon Sep 17 00:00:00 2001 From: "linghao.su" Date: Thu, 29 Jun 2023 23:20:25 +0800 Subject: [PATCH 2/3] feat(pie): add endAngle insteadof angleRange --- src/chart/pie/PieSeries.ts | 4 ++-- src/chart/pie/pieLayout.ts | 20 +++++++++++++++++--- test/pie-endAngle.html | 15 +++------------ test/runTest/actions/pie-endAngle.json | 2 +- 4 files changed, 23 insertions(+), 18 deletions(-) diff --git a/src/chart/pie/PieSeries.ts b/src/chart/pie/PieSeries.ts index 3cb5a8fffd..5d0fd4ade6 100644 --- a/src/chart/pie/PieSeries.ts +++ b/src/chart/pie/PieSeries.ts @@ -112,7 +112,7 @@ export interface PieSeriesOption extends clockwise?: boolean startAngle?: number - angleRange?: number + endAngle?: number | 'auto' minAngle?: number minShowLabelAngle?: number @@ -218,7 +218,7 @@ class PieSeriesModel extends SeriesModel { // 默认顺时针 clockwise: true, startAngle: 90, - angleRange: 360, + endAngle: 'auto', // 最小角度改为0 minAngle: 0, diff --git a/src/chart/pie/pieLayout.ts b/src/chart/pie/pieLayout.ts index 171bb3df8a..652dffdcbd 100644 --- a/src/chart/pie/pieLayout.ts +++ b/src/chart/pie/pieLayout.ts @@ -24,6 +24,8 @@ import GlobalModel from '../../model/Global'; import ExtensionAPI from '../../core/ExtensionAPI'; import PieSeriesModel from './PieSeries'; import { SectorShape } from 'zrender/src/graphic/shape/Sector'; +import { normalizeRadian } from 'zrender/src/contain/util'; +import { normalizeArcAngles } from 'zrender/src/core/PathProxy'; const PI2 = Math.PI * 2; const RADIAN = Math.PI / 180; @@ -91,9 +93,10 @@ export default function pieLayout( const { cx, cy, r, r0 } = getBasicPieLayout(seriesModel, api); - const startAngle = -seriesModel.get('startAngle') * RADIAN; + let startAngle = -seriesModel.get('startAngle') * RADIAN; + let endAngle = startAngle - PI2; - const angleRange = seriesModel.get('angleRange') * RADIAN || PI2; + const endAngleModel = seriesModel.get('endAngle'); const minAngle = seriesModel.get('minAngle') * RADIAN; @@ -115,12 +118,23 @@ export default function pieLayout( const extent = data.getDataExtent(valueDim); extent[0] = 0; + if (endAngleModel !== 'auto') { + endAngle = -endAngleModel * RADIAN; + } + + const dir = clockwise ? 1 : -1; + const angles = [startAngle, endAngle]; + normalizeArcAngles(angles, !clockwise); + + [startAngle, endAngle] = angles; + + const angleRange = Math.abs(endAngle - startAngle); + // In the case some sector angle is smaller than minAngle let restAngle = angleRange; let valueSumLargerThanMinAngle = 0; let currentAngle = startAngle; - const dir = clockwise ? 1 : -1; data.setLayout({ viewRect, r }); diff --git a/test/pie-endAngle.html b/test/pie-endAngle.html index 95000d97f1..0d5ed987b0 100644 --- a/test/pie-endAngle.html +++ b/test/pie-endAngle.html @@ -34,9 +34,6 @@
-
-
-
- \ No newline at end of file diff --git a/test/runTest/actions/pie-endAngle.json b/test/runTest/actions/pie-endAngle.json index bd226911b9..8252f9f9e0 100644 --- a/test/runTest/actions/pie-endAngle.json +++ b/test/runTest/actions/pie-endAngle.json @@ -1 +1 @@ -[{"name":"Action 1","ops":[{"type":"mousemove","time":222,"x":515,"y":550},{"type":"mousemove","time":423,"x":697,"y":31},{"type":"mousemove","time":631,"x":705,"y":28},{"type":"mousemove","time":833,"x":750,"y":65},{"type":"mousemove","time":1037,"x":710,"y":74},{"type":"mousemove","time":1237,"x":685,"y":72},{"type":"mousemove","time":1439,"x":681,"y":72},{"type":"mousemove","time":1686,"x":681,"y":71},{"type":"mousemove","time":1889,"x":676,"y":66},{"type":"mousemove","time":2095,"x":635,"y":34},{"type":"mousemove","time":2295,"x":635,"y":41},{"type":"mousemove","time":2506,"x":635,"y":43},{"type":"mousemove","time":2715,"x":636,"y":43},{"type":"screenshot","time":3650},{"type":"screenshot","time":4908},{"type":"mousedown","time":5359,"x":636,"y":43},{"type":"mousemove","time":5588,"x":637,"y":43},{"type":"mousemove","time":5789,"x":673,"y":42},{"type":"mousemove","time":5989,"x":678,"y":42},{"type":"mousemove","time":6747,"x":679,"y":42},{"type":"mousemove","time":6950,"x":685,"y":42},{"type":"mouseup","time":7116,"x":685,"y":42},{"time":7117,"delay":400,"type":"screenshot-auto"},{"type":"screenshot","time":7714},{"type":"mousedown","time":8142,"x":685,"y":42},{"type":"mousemove","time":8338,"x":685,"y":42},{"type":"mousemove","time":8541,"x":703,"y":41},{"type":"mouseup","time":8675,"x":708,"y":41},{"time":8676,"delay":400,"type":"screenshot-auto"},{"type":"mousemove","time":8749,"x":708,"y":41},{"type":"screenshot","time":9425},{"type":"mousemove","time":9553,"x":707,"y":42},{"type":"mousemove","time":9753,"x":679,"y":67},{"type":"mousemove","time":9956,"x":678,"y":69},{"type":"mousemove","time":10163,"x":679,"y":70},{"type":"mousedown","time":10317,"x":679,"y":70},{"type":"mousemove","time":10520,"x":678,"y":70},{"type":"mousemove","time":10720,"x":668,"y":70},{"type":"mousemove","time":10921,"x":660,"y":72},{"type":"mousemove","time":11121,"x":656,"y":74},{"type":"mouseup","time":11142,"x":656,"y":74},{"time":11143,"delay":400,"type":"screenshot-auto"},{"type":"screenshot","time":11808},{"type":"mousedown","time":12542,"x":656,"y":74},{"type":"mousemove","time":12779,"x":656,"y":74},{"type":"mousemove","time":12979,"x":676,"y":74},{"type":"mousemove","time":13181,"x":679,"y":74},{"type":"mousemove","time":13392,"x":679,"y":74},{"type":"mousemove","time":13412,"x":680,"y":74},{"type":"mousemove","time":13615,"x":681,"y":74},{"type":"mouseup","time":14050,"x":681,"y":74},{"time":14051,"delay":400,"type":"screenshot-auto"},{"type":"mousemove","time":14055,"x":681,"y":74},{"type":"screenshot","time":14434},{"type":"mousemove","time":14929,"x":681,"y":74},{"type":"mousemove","time":15131,"x":680,"y":92},{"type":"mousemove","time":15337,"x":679,"y":95},{"type":"mousedown","time":15350,"x":679,"y":95},{"type":"mousemove","time":15578,"x":679,"y":95},{"type":"mousemove","time":15779,"x":659,"y":98},{"type":"mousemove","time":15983,"x":643,"y":102},{"type":"mouseup","time":16167,"x":628,"y":105},{"time":16168,"delay":400,"type":"screenshot-auto"},{"type":"mousemove","time":16190,"x":628,"y":105},{"type":"screenshot","time":17140},{"type":"mousemove","time":17153,"x":628,"y":104},{"type":"mousemove","time":17354,"x":631,"y":102},{"type":"mousemove","time":17555,"x":631,"y":102},{"type":"mousemove","time":17755,"x":640,"y":95},{"type":"mousemove","time":17958,"x":643,"y":94},{"type":"mousedown","time":18257,"x":643,"y":94},{"type":"mousemove","time":18454,"x":644,"y":94},{"type":"mousemove","time":18656,"x":665,"y":94},{"type":"mouseup","time":18816,"x":665,"y":94},{"time":18817,"delay":400,"type":"screenshot-auto"},{"type":"mousemove","time":18820,"x":666,"y":94},{"type":"screenshot","time":19499},{"type":"mousemove","time":20054,"x":667,"y":94},{"type":"mousemove","time":20255,"x":676,"y":94},{"type":"mousemove","time":20371,"x":676,"y":94},{"type":"mousemove","time":20573,"x":717,"y":95},{"type":"mousedown","time":20784,"x":717,"y":95},{"type":"mouseup","time":20924,"x":717,"y":95},{"time":20925,"delay":400,"type":"screenshot-auto"},{"type":"screenshot","time":21372},{"type":"mousemove","time":21654,"x":717,"y":95},{"type":"mousemove","time":21855,"x":675,"y":100},{"type":"mousemove","time":22058,"x":668,"y":102},{"type":"mousemove","time":22261,"x":656,"y":101},{"type":"mousedown","time":22332,"x":656,"y":101},{"type":"mousemove","time":22462,"x":656,"y":101},{"type":"mouseup","time":22491,"x":656,"y":101},{"time":22492,"delay":400,"type":"screenshot-auto"},{"type":"screenshot","time":23440},{"type":"mousemove","time":23680,"x":655,"y":101},{"type":"mousemove","time":23881,"x":640,"y":97},{"type":"mousemove","time":24089,"x":640,"y":97},{"type":"mousedown","time":24250,"x":640,"y":97},{"type":"mouseup","time":24382,"x":640,"y":97},{"time":24383,"delay":400,"type":"screenshot-auto"},{"type":"screenshot","time":25224},{"type":"mousemove","time":26387,"x":640,"y":96},{"type":"mousemove","time":26589,"x":657,"y":71},{"type":"mousemove","time":26795,"x":660,"y":40},{"type":"mousemove","time":26996,"x":658,"y":33},{"type":"mousemove","time":27196,"x":653,"y":22},{"type":"mousedown","time":27340,"x":651,"y":19},{"type":"mousemove","time":27397,"x":651,"y":19},{"type":"mouseup","time":27439,"x":651,"y":19},{"time":27440,"delay":400,"type":"screenshot-auto"},{"type":"screenshot","time":28459},{"type":"mousemove","time":28736,"x":651,"y":20},{"type":"mousemove","time":28937,"x":663,"y":42},{"type":"mousedown","time":29133,"x":663,"y":43},{"type":"mousemove","time":29144,"x":663,"y":43},{"type":"mouseup","time":29266,"x":663,"y":43},{"time":29267,"delay":400,"type":"screenshot-auto"},{"type":"screenshot","time":30085},{"type":"mousemove","time":30178,"x":663,"y":42},{"type":"mousemove","time":30381,"x":670,"y":40},{"type":"mousemove","time":30586,"x":693,"y":67},{"type":"mousemove","time":30789,"x":693,"y":69},{"type":"mousemove","time":30994,"x":697,"y":51},{"type":"mousemove","time":31194,"x":696,"y":47},{"type":"mousedown","time":31388,"x":710,"y":39},{"type":"mousemove","time":31403,"x":710,"y":39},{"type":"mouseup","time":31494,"x":710,"y":39},{"time":31495,"delay":400,"type":"screenshot-auto"},{"type":"screenshot","time":32331},{"type":"mousemove","time":32396,"x":713,"y":39},{"type":"mousemove","time":32598,"x":796,"y":57}],"scrollY":0,"scrollX":0,"timestamp":1687962537508}] \ No newline at end of file +[{"name":"Action 1","ops":[{"type":"mousemove","time":358,"x":603,"y":513},{"type":"mousemove","time":558,"x":610,"y":488},{"type":"screenshot","time":958},{"type":"mousemove","time":1083,"x":610,"y":488},{"type":"mousemove","time":1283,"x":724,"y":87},{"type":"mousemove","time":1485,"x":719,"y":79},{"type":"mousemove","time":1557,"x":719,"y":79},{"type":"mousemove","time":1759,"x":667,"y":46},{"type":"mousemove","time":1959,"x":671,"y":45},{"type":"mousemove","time":2161,"x":658,"y":58},{"type":"mousemove","time":2369,"x":634,"y":29},{"type":"mousemove","time":2574,"x":634,"y":22},{"type":"mousedown","time":2766,"x":638,"y":14},{"type":"mousemove","time":2775,"x":638,"y":14},{"type":"mouseup","time":2866,"x":638,"y":14},{"time":2867,"delay":400,"type":"screenshot-auto"},{"type":"screenshot","time":4014},{"type":"mousemove","time":4601,"x":639,"y":14},{"type":"mousemove","time":4802,"x":659,"y":25},{"type":"mousemove","time":5208,"x":659,"y":25},{"type":"mousemove","time":5408,"x":671,"y":56},{"type":"mousemove","time":5608,"x":669,"y":66},{"type":"mousemove","time":5819,"x":669,"y":67},{"type":"mousedown","time":6129,"x":669,"y":67},{"type":"mouseup","time":6287,"x":669,"y":67},{"time":6288,"delay":400,"type":"screenshot-auto"},{"type":"mousemove","time":6816,"x":669,"y":67},{"type":"mousemove","time":7016,"x":669,"y":43},{"type":"mousemove","time":7216,"x":668,"y":56},{"type":"mousemove","time":7416,"x":670,"y":52},{"type":"mousemove","time":7617,"x":670,"y":44},{"type":"screenshot","time":7827},{"type":"mousemove","time":8092,"x":670,"y":44},{"type":"mousemove","time":8293,"x":636,"y":22},{"type":"mousedown","time":8494,"x":637,"y":13},{"type":"mousemove","time":8503,"x":637,"y":13},{"type":"mouseup","time":8602,"x":637,"y":13},{"time":8603,"delay":400,"type":"screenshot-auto"},{"type":"screenshot","time":9669},{"type":"mousemove","time":10116,"x":637,"y":14},{"type":"mousemove","time":10316,"x":666,"y":49},{"type":"mousemove","time":10516,"x":692,"y":42},{"type":"mousemove","time":10718,"x":692,"y":42},{"type":"mousemove","time":10935,"x":689,"y":43},{"type":"mousemove","time":11208,"x":689,"y":43},{"type":"mousedown","time":11328,"x":693,"y":41},{"type":"mousemove","time":11411,"x":693,"y":41},{"type":"mouseup","time":11420,"x":693,"y":41},{"time":11421,"delay":400,"type":"screenshot-auto"},{"type":"screenshot","time":13405},{"type":"mousemove","time":13541,"x":692,"y":41},{"type":"mousemove","time":13741,"x":657,"y":21},{"type":"mousemove","time":13947,"x":645,"y":17},{"type":"mousemove","time":14152,"x":640,"y":16},{"type":"mousedown","time":14161,"x":640,"y":16},{"type":"mouseup","time":14279,"x":640,"y":16},{"time":14280,"delay":400,"type":"screenshot-auto"},{"type":"screenshot","time":15711},{"type":"mousemove","time":16984,"x":640,"y":16},{"type":"mousemove","time":17317,"x":640,"y":16},{"type":"mousemove","time":17519,"x":640,"y":16},{"type":"mousemove","time":17701,"x":639,"y":16},{"type":"mousedown","time":19029,"x":639,"y":16},{"type":"mouseup","time":19161,"x":639,"y":16},{"time":19162,"delay":400,"type":"screenshot-auto"},{"type":"mousemove","time":20342,"x":639,"y":16},{"type":"mousemove","time":20544,"x":672,"y":74},{"type":"mousemove","time":20753,"x":669,"y":75},{"type":"mousemove","time":20866,"x":668,"y":75},{"type":"mousemove","time":21068,"x":642,"y":77},{"type":"mousemove","time":21275,"x":641,"y":77},{"type":"mousemove","time":21478,"x":638,"y":77},{"type":"mousemove","time":21686,"x":633,"y":75},{"type":"mousemove","time":21808,"x":634,"y":75},{"type":"mousemove","time":22011,"x":638,"y":73},{"type":"mousemove","time":22275,"x":638,"y":73},{"type":"mousemove","time":22477,"x":632,"y":73},{"type":"mousemove","time":22686,"x":628,"y":73},{"type":"mousedown","time":22940,"x":628,"y":73},{"type":"mouseup","time":23079,"x":628,"y":73},{"time":23080,"delay":400,"type":"screenshot-auto"},{"type":"mousemove","time":23475,"x":629,"y":72},{"type":"mousemove","time":23675,"x":719,"y":42},{"type":"mousemove","time":23877,"x":720,"y":42},{"type":"mousemove","time":23916,"x":720,"y":42},{"type":"mousemove","time":24118,"x":707,"y":46},{"type":"mousemove","time":24357,"x":709,"y":46},{"type":"mousedown","time":24398,"x":709,"y":46},{"type":"mousemove","time":24617,"x":709,"y":46},{"type":"mouseup","time":24756,"x":714,"y":46},{"time":24757,"delay":400,"type":"screenshot-auto"},{"type":"mousemove","time":24820,"x":715,"y":46},{"type":"mousemove","time":25842,"x":712,"y":46},{"type":"screenshot","time":25847},{"type":"mousemove","time":26044,"x":666,"y":35},{"type":"mousemove","time":26252,"x":628,"y":24},{"type":"mousemove","time":26458,"x":637,"y":18},{"type":"mousedown","time":26527,"x":639,"y":15},{"type":"mouseup","time":26644,"x":639,"y":15},{"time":26645,"delay":400,"type":"screenshot-auto"},{"type":"mousemove","time":26661,"x":639,"y":15},{"type":"screenshot","time":27811},{"type":"mousemove","time":28875,"x":639,"y":15},{"type":"mousemove","time":29749,"x":639,"y":15},{"type":"mousemove","time":29950,"x":642,"y":81},{"type":"mousemove","time":30152,"x":631,"y":82},{"type":"mousemove","time":30361,"x":625,"y":74},{"type":"mousedown","time":30554,"x":625,"y":74},{"type":"mousemove","time":30808,"x":625,"y":74},{"type":"mousemove","time":31011,"x":620,"y":74},{"type":"mousemove","time":31217,"x":618,"y":74},{"type":"mousemove","time":31417,"x":616,"y":74},{"type":"mouseup","time":31463,"x":615,"y":74},{"time":31464,"delay":400,"type":"screenshot-auto"},{"type":"mousemove","time":31619,"x":615,"y":74},{"type":"mousemove","time":32657,"x":615,"y":74},{"type":"screenshot","time":32696},{"type":"mousemove","time":32858,"x":636,"y":24},{"type":"mousemove","time":33059,"x":637,"y":23},{"type":"mousemove","time":33259,"x":638,"y":14},{"type":"mousedown","time":33340,"x":638,"y":14},{"type":"mouseup","time":33466,"x":638,"y":14},{"time":33467,"delay":400,"type":"screenshot-auto"},{"type":"screenshot","time":34594},{"type":"mousemove","time":34766,"x":639,"y":14},{"type":"mousemove","time":34966,"x":707,"y":47},{"type":"mousemove","time":35166,"x":709,"y":47},{"type":"mousemove","time":35373,"x":711,"y":45},{"type":"mousemove","time":35499,"x":711,"y":45},{"type":"mousemove","time":35700,"x":706,"y":45},{"type":"mousemove","time":35903,"x":643,"y":46},{"type":"mousemove","time":36120,"x":624,"y":47},{"type":"mousemove","time":36333,"x":622,"y":47},{"type":"mousemove","time":36533,"x":621,"y":46},{"type":"mousemove","time":36736,"x":620,"y":46},{"type":"mousedown","time":36740,"x":620,"y":46},{"type":"mouseup","time":36889,"x":620,"y":46},{"time":36890,"delay":400,"type":"screenshot-auto"},{"type":"mousemove","time":37109,"x":620,"y":46},{"type":"mousemove","time":37312,"x":620,"y":44},{"type":"mousemove","time":37418,"x":620,"y":44},{"type":"mousemove","time":37621,"x":622,"y":42},{"type":"mousedown","time":37717,"x":622,"y":42},{"type":"mouseup","time":37864,"x":622,"y":42},{"time":37865,"delay":400,"type":"screenshot-auto"},{"type":"mousemove","time":38109,"x":622,"y":43},{"type":"mousemove","time":38309,"x":704,"y":85},{"type":"mousemove","time":38509,"x":710,"y":66},{"type":"mousemove","time":38711,"x":714,"y":63},{"type":"mousedown","time":38890,"x":714,"y":63},{"type":"mousemove","time":38928,"x":714,"y":63},{"type":"mouseup","time":38956,"x":714,"y":63},{"time":38957,"delay":400,"type":"screenshot-auto"},{"type":"mousemove","time":39166,"x":714,"y":63},{"type":"mousemove","time":39369,"x":714,"y":67},{"type":"mousemove","time":39576,"x":712,"y":70},{"type":"mousedown","time":39830,"x":712,"y":70},{"type":"mouseup","time":39970,"x":712,"y":70},{"time":39971,"delay":400,"type":"screenshot-auto"},{"type":"mousemove","time":40542,"x":712,"y":69},{"type":"mousemove","time":40744,"x":712,"y":68},{"type":"screenshot","time":40773},{"type":"mousemove","time":40791,"x":712,"y":68},{"type":"mousemove","time":40992,"x":712,"y":67},{"type":"mousemove","time":41192,"x":720,"y":81},{"type":"mousemove","time":41392,"x":719,"y":81},{"type":"mousemove","time":41593,"x":626,"y":40},{"type":"mousemove","time":41795,"x":626,"y":41},{"type":"mousedown","time":41921,"x":626,"y":41},{"type":"mousemove","time":42099,"x":626,"y":41},{"type":"mousemove","time":42300,"x":608,"y":41},{"type":"mouseup","time":42312,"x":608,"y":41},{"time":42313,"delay":400,"type":"screenshot-auto"},{"type":"mousemove","time":42521,"x":608,"y":41},{"type":"mousemove","time":42618,"x":608,"y":41},{"type":"mousemove","time":42820,"x":640,"y":18},{"type":"mousemove","time":43029,"x":646,"y":14},{"type":"mousemove","time":43233,"x":709,"y":93},{"type":"mousemove","time":43437,"x":712,"y":85},{"type":"mousemove","time":43669,"x":712,"y":76},{"type":"mousemove","time":43886,"x":712,"y":75},{"type":"mousedown","time":43924,"x":712,"y":75},{"type":"mousemove","time":44067,"x":712,"y":75},{"type":"mouseup","time":44173,"x":747,"y":75},{"time":44174,"delay":400,"type":"screenshot-auto"},{"type":"mousemove","time":44270,"x":749,"y":75},{"type":"mousemove","time":44483,"x":749,"y":75},{"type":"mousemove","time":44683,"x":662,"y":27},{"type":"mousemove","time":44883,"x":638,"y":17},{"type":"mousemove","time":45083,"x":637,"y":16},{"type":"mousemove","time":45293,"x":636,"y":16},{"type":"screenshot","time":45316},{"type":"mousedown","time":45700,"x":636,"y":16},{"type":"mouseup","time":45808,"x":636,"y":16},{"time":45809,"delay":400,"type":"screenshot-auto"},{"type":"screenshot","time":46896}],"scrollY":0,"scrollX":0,"timestamp":1688051759455}] \ No newline at end of file From 65d744213d833c750bfddcce6e4fc18dcaba27e2 Mon Sep 17 00:00:00 2001 From: "linghao.su" Date: Mon, 3 Jul 2023 12:52:57 +0800 Subject: [PATCH 3/3] fix(pie): fix endAngle logical more compact --- src/chart/pie/pieLayout.ts | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/chart/pie/pieLayout.ts b/src/chart/pie/pieLayout.ts index 652dffdcbd..e81afae432 100644 --- a/src/chart/pie/pieLayout.ts +++ b/src/chart/pie/pieLayout.ts @@ -24,7 +24,6 @@ import GlobalModel from '../../model/Global'; import ExtensionAPI from '../../core/ExtensionAPI'; import PieSeriesModel from './PieSeries'; import { SectorShape } from 'zrender/src/graphic/shape/Sector'; -import { normalizeRadian } from 'zrender/src/contain/util'; import { normalizeArcAngles } from 'zrender/src/core/PathProxy'; const PI2 = Math.PI * 2; @@ -94,9 +93,8 @@ export default function pieLayout( const { cx, cy, r, r0 } = getBasicPieLayout(seriesModel, api); let startAngle = -seriesModel.get('startAngle') * RADIAN; - let endAngle = startAngle - PI2; - - const endAngleModel = seriesModel.get('endAngle'); + let endAngle = seriesModel.get('endAngle'); + endAngle = endAngle === 'auto' ? startAngle - PI2 : -endAngle * RADIAN; const minAngle = seriesModel.get('minAngle') * RADIAN; @@ -118,10 +116,6 @@ export default function pieLayout( const extent = data.getDataExtent(valueDim); extent[0] = 0; - if (endAngleModel !== 'auto') { - endAngle = -endAngleModel * RADIAN; - } - const dir = clockwise ? 1 : -1; const angles = [startAngle, endAngle]; normalizeArcAngles(angles, !clockwise);