Skip to content

Commit

Permalink
Merge pull request #17691 from ZeekoZhu/echarts-17633
Browse files Browse the repository at this point in the history
fix #17633: add gauge sectors in the order of the "clockwise" option
  • Loading branch information
Ovilia authored Sep 28, 2022
2 parents 9bbdb22 + 204a04c commit 213f7eb
Show file tree
Hide file tree
Showing 2 changed files with 110 additions and 49 deletions.
8 changes: 6 additions & 2 deletions src/chart/gauge/GaugeView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import SeriesData from '../../data/SeriesData';
import Sausage from '../../util/shape/sausage';
import {createSymbol} from '../../util/symbol';
import ZRImage from 'zrender/src/graphic/Image';
import {extend, isFunction, isString, isNumber} from 'zrender/src/core/util';
import { extend, isFunction, isString, isNumber, each } from 'zrender/src/core/util';
import {setCommonECData} from '../../util/innerStore';
import { normalizeArcAngles } from 'zrender/src/core/PathProxy';

Expand Down Expand Up @@ -127,6 +127,7 @@ class GaugeView extends ChartView {

let prevEndAngle = startAngle;

const sectors: (Sausage | graphic.Sector)[] = [];
for (let i = 0; showAxis && i < colorList.length; i++) {
// Clamp
const percent = Math.min(Math.max(colorList[i][0], 0), 1);
Expand Down Expand Up @@ -154,11 +155,14 @@ class GaugeView extends ChartView {
['color', 'width']
));

group.add(sector);
sectors.push(sector);

prevEndAngle = endAngle;
}

sectors.reverse();
each(sectors, sector => group.add(sector));

const getColor = function (percent: number) {
// Less than 0
if (percent <= 0) {
Expand Down
151 changes: 104 additions & 47 deletions test/gauge-case.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 213f7eb

Please sign in to comment.