Skip to content

Commit

Permalink
fix(gauge): add sectors by the order of the 'clockwise' option
Browse files Browse the repository at this point in the history
  • Loading branch information
ZeekoZhu committed Sep 24, 2022
1 parent 81cbfcb commit 86bbd4d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/chart/gauge/GaugeView.ts
Original file line number Diff line number Diff line change
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();
sectors.forEach(sector => group.add(sector));

const getColor = function (percent: number) {
// Less than 0
if (percent <= 0) {
Expand Down

0 comments on commit 86bbd4d

Please sign in to comment.