Skip to content

Commit f3f46dc

Browse files
authored
Merge pull request #460 from vizzuhq/rotate_to_angle
Rename rotate setting to angle
2 parents 234104f + 518dcf0 commit f3f46dc

File tree

9 files changed

+36
-61
lines changed

9 files changed

+36
-61
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
- At the mouse events the lib is not queried the exact rendered chart position through API.
1111
- On axis labels sometimes missed a space character between value and unit.
1212
- Rendered label units are suddenly disappeared when target plot does not contain a unit.
13+
- Remove "rotate" setting, add "angle" setting.
1314

1415
### Added
1516

src/apps/weblib/ts-api/plugins/presets.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export default class Presets {
3434
align: 'none',
3535
coordSystem: 'cartesian',
3636
orientation: 'auto',
37-
rotate: 0,
37+
angle: 0,
3838
split: false,
3939
geometry: 'rectangle',
4040
channels: {

src/apps/weblib/typeschema-api/config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,9 +189,9 @@ definitions:
189189
coordinate system to create a chart from the pie/radial chart family.
190190
type: string
191191
enum: [cartesian, polar]
192-
rotate:
192+
angle:
193193
description: |
194-
Rotates the plot area by the specified angle in degree.
194+
Rotates the plot area to the specified angle in radian.
195195
Note: this is an experimental, not tested feature.
196196
type: number
197197
geometry:

src/chart/options/config.cpp

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -63,19 +63,7 @@ const Config::Accessors &Config::getAccessors()
6363
accessor<&Options::caption>,
6464
accessor<&Options::legend>,
6565
accessor<&Options::coordSystem>,
66-
{"rotate",
67-
{.get =
68-
[](const Options &options)
69-
{
70-
return Conv::toString(
71-
90 * options.angle / (M_PI / 2));
72-
},
73-
.set =
74-
[](OptionsSetter &setter,
75-
const std::string &value)
76-
{
77-
setter.rotate(Conv::parse<double>(value) / 90);
78-
}}},
66+
accessor<&Options::angle>,
7967
accessor<&Options::geometry>,
8068
accessor<&Options::orientation>,
8169
accessor<&Options::sort>,

src/chart/options/optionssetter.cpp

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -67,18 +67,6 @@ OptionsSetter &OptionsSetter::clearSeries(const ChannelId &channelId)
6767
return *this;
6868
}
6969

70-
OptionsSetter &OptionsSetter::rotate(double ccwQuadrant)
71-
{
72-
options.angle += ccwQuadrant * M_PI / 2;
73-
return *this;
74-
}
75-
76-
OptionsSetter &OptionsSetter::setAngle(double ccwQuadrant)
77-
{
78-
options.angle = ccwQuadrant * M_PI / 2;
79-
return *this;
80-
}
81-
8270
OptionsSetter &OptionsSetter::setFilter(const Data::Filter &filter)
8371
{
8472
options.dataFilter = filter;

src/chart/options/optionssetter.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@ class OptionsSetter
3535
std::optional<size_t> pos);
3636
OptionsSetter &deleteSeries(const ChannelId &channelId,
3737
const Data::SeriesIndex &index);
38-
OptionsSetter &rotate(double ccwQuadrant);
39-
OptionsSetter &setAngle(double ccwQuadrant);
4038
OptionsSetter &setFilter(const Data::Filter &filter);
4139
OptionsSetter &addMarkerInfo(Options::MarkerId marker);
4240
OptionsSetter &moveMarkerInfo(Options::MarkerId from,

test/integration/test_cases/basic_animations/labels/rectangle_labels_rotated_charts.mjs

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ const testSteps = [
3838
chart.animate({
3939
config: {
4040
title: 'Rectangle Marker Label Positions - Top',
41-
rotate: 10
41+
angle: Math.PI / 18
4242
},
4343
style: {
4444
plot: {
@@ -55,7 +55,7 @@ const testSteps = [
5555
chart.animate({
5656
config: {
5757
title: 'Rectangle Marker Label Positions - Left',
58-
rotate: 10
58+
angle: (Math.PI * 2) / 18
5959
},
6060
style: {
6161
plot: {
@@ -71,7 +71,7 @@ const testSteps = [
7171
chart.animate({
7272
config: {
7373
title: 'Rectangle Marker Label Positions - Bottom',
74-
rotate: 10
74+
angle: (Math.PI * 3) / 18
7575
},
7676
style: {
7777
plot: {
@@ -87,7 +87,7 @@ const testSteps = [
8787
chart.animate({
8888
config: {
8989
title: 'Rectangle Marker Label Positions - Right',
90-
rotate: 10
90+
angle: (Math.PI * 4) / 18
9191
},
9292
style: {
9393
plot: {
@@ -103,7 +103,7 @@ const testSteps = [
103103
chart.animate({
104104
config: {
105105
title: 'Rectangle Marker Label Positions - Center/Horizontal',
106-
rotate: 10
106+
angle: (Math.PI * 5) / 18
107107
},
108108
style: {
109109
plot: {
@@ -119,7 +119,7 @@ const testSteps = [
119119
chart.animate({
120120
config: {
121121
title: 'Rectangle Marker Label Positions - Center/Tangential',
122-
rotate: 10
122+
angle: (Math.PI * 6) / 18
123123
},
124124
style: {
125125
plot: {
@@ -135,7 +135,7 @@ const testSteps = [
135135
chart.animate({
136136
config: {
137137
title: 'Rectangle Marker Label Positions - Center/Normal',
138-
rotate: 10
138+
angle: (Math.PI * 7) / 18
139139
},
140140
style: {
141141
plot: {
@@ -151,7 +151,7 @@ const testSteps = [
151151
chart.animate({
152152
config: {
153153
title: 'Rectangle Marker Label Positions - Center/Vertical',
154-
rotate: 10
154+
angle: (Math.PI * 8) / 18
155155
},
156156
style: {
157157
plot: {
@@ -171,7 +171,7 @@ const testSteps = [
171171
label: { attach: ['Value 2 (+)'] }
172172
},
173173
title: 'Change Continuous',
174-
rotate: 10
174+
angle: (Math.PI * 9) / 18
175175
},
176176
style: {
177177
plot: {
@@ -193,7 +193,7 @@ const testSteps = [
193193
label: { attach: ['Value 2 (+)', 'Country'] }
194194
},
195195
title: 'Polar Coordinate',
196-
rotate: 180,
196+
angle: (Math.PI * 27) / 18,
197197
coordSystem: 'polar'
198198
},
199199
style: {
@@ -210,7 +210,7 @@ const testSteps = [
210210
chart.animate({
211211
config: {
212212
title: 'Rectangle Marker Label Positions - Left',
213-
rotate: 10
213+
angle: (Math.PI * 28) / 18
214214
},
215215
style: {
216216
plot: {
@@ -226,7 +226,7 @@ const testSteps = [
226226
chart.animate({
227227
config: {
228228
title: 'Rectangle Marker Label Positions - Bottom',
229-
rotate: 10
229+
angle: (Math.PI * 29) / 18
230230
},
231231
style: {
232232
plot: {
@@ -242,7 +242,7 @@ const testSteps = [
242242
chart.animate({
243243
config: {
244244
title: 'Rectangle Marker Label Positions - Right',
245-
rotate: 10
245+
angle: (Math.PI * 30) / 18
246246
},
247247
style: {
248248
plot: {
@@ -258,7 +258,7 @@ const testSteps = [
258258
chart.animate({
259259
config: {
260260
title: 'Rectangle Marker Label Positions - Center/Horizontal',
261-
rotate: 10
261+
angle: (Math.PI * 31) / 18
262262
},
263263
style: {
264264
plot: {
@@ -275,7 +275,7 @@ const testSteps = [
275275
chart.animate({
276276
config: {
277277
title: 'Rectangle Marker Label Positions - Top/Normal',
278-
rotate: 10
278+
angle: (Math.PI * 32) / 18
279279
},
280280
style: {
281281
plot: {
@@ -292,7 +292,7 @@ const testSteps = [
292292
chart.animate({
293293
config: {
294294
title: 'Rectangle Marker Label Positions - Top/Vertical',
295-
rotate: 10
295+
angle: (Math.PI * 33) / 18
296296
},
297297
style: {
298298
plot: {
@@ -308,7 +308,7 @@ const testSteps = [
308308
chart.animate({
309309
config: {
310310
title: 'Rectangle Marker Label Positions - Top/Tangential',
311-
rotate: 10
311+
angle: (Math.PI * 34) / 18
312312
},
313313
style: {
314314
plot: {
@@ -324,7 +324,7 @@ const testSteps = [
324324
chart.animate({
325325
config: {
326326
title: 'Rectangle Marker Label Positions - Top/Angle',
327-
rotate: 10
327+
angle: (Math.PI * 35) / 18
328328
},
329329
style: {
330330
plot: {
@@ -344,7 +344,7 @@ const testSteps = [
344344
size: { attach: ['Value 2 (+)'] }
345345
},
346346
title: 'Without Coordinate',
347-
rotate: 10,
347+
angle: (Math.PI * 36) / 18,
348348
coordSystem: 'cartesian'
349349
},
350350
style: {
@@ -362,7 +362,7 @@ const testSteps = [
362362
chart.animate({
363363
config: {
364364
title: 'Rectangle Marker Label Positions - Center/Horizontal',
365-
rotate: 10
365+
angle: (Math.PI * 37) / 18
366366
},
367367
style: {
368368
plot: {
@@ -392,7 +392,7 @@ const testSteps = [
392392
chart.animate({
393393
config: {
394394
title: 'Rectangle Marker Label Positions - Left',
395-
rotate: 10
395+
angle: (Math.PI * 38) / 18
396396
},
397397
style: {
398398
plot: {
@@ -408,7 +408,7 @@ const testSteps = [
408408
chart.animate({
409409
config: {
410410
title: 'Rectangle Marker Label Positions - Bottom',
411-
rotate: 10
411+
angle: (Math.PI * 39) / 18
412412
},
413413
style: {
414414
plot: {
@@ -424,7 +424,7 @@ const testSteps = [
424424
chart.animate({
425425
config: {
426426
title: 'Rectangle Marker Label Positions - Right',
427-
rotate: 10
427+
angle: (Math.PI * 40) / 18
428428
},
429429
style: {
430430
plot: {
@@ -440,7 +440,7 @@ const testSteps = [
440440
chart.animate({
441441
config: {
442442
title: 'Rectangle Marker Label Positions - Center/Horizontal',
443-
rotate: 10
443+
angle: (Math.PI * 41) / 18
444444
},
445445
style: {
446446
plot: {
@@ -457,7 +457,7 @@ const testSteps = [
457457
chart.animate({
458458
config: {
459459
title: 'Rectangle Marker Label Positions - Top/Normal',
460-
rotate: 10
460+
angle: (Math.PI * 42) / 18
461461
},
462462
style: {
463463
plot: {
@@ -474,7 +474,7 @@ const testSteps = [
474474
chart.animate({
475475
config: {
476476
title: 'Rectangle Marker Label Positions - Top/Vertical',
477-
rotate: -360
477+
angle: (Math.PI * 6) / 18
478478
},
479479
style: {
480480
plot: {
@@ -490,7 +490,7 @@ const testSteps = [
490490
chart.animate({
491491
config: {
492492
title: 'Rectangle Marker Label Positions - Top/Tangential',
493-
rotate: 100
493+
angle: (Math.PI * 16) / 18
494494
},
495495
style: {
496496
plot: {
@@ -506,7 +506,7 @@ const testSteps = [
506506
chart.animate({
507507
config: {
508508
title: 'Rectangle Marker Label Positions - Top/Angle',
509-
rotate: 380
509+
angle: (Math.PI * 54) / 18
510510
},
511511
style: {
512512
plot: {

test/integration/test_cases/test_cases.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
"refs": ["1d1c034"]
5454
},
5555
"basic_animations/labels/rectangle_labels_rotated_charts": {
56-
"refs": ["8b5c0bd"]
56+
"refs": ["6ee1ac0"]
5757
},
5858
"basic_animations/legend_transitions/color_2discrete_anim": {
5959
"refs": ["955eea3"]

test/integration/test_cases/ww_noFade/wNoFade_Tests/Marker_label_problem/rotated_bar_to_donut.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const testSteps = [
3232
label: 'Value 5 (+/-)'
3333
},
3434
title: 'Rectangle Marker Label Positions - Center',
35-
rotate: 90
35+
angle: Math.PI / 2
3636
}
3737
}),
3838

@@ -45,7 +45,7 @@ const testSteps = [
4545
label: { attach: ['Value 5 (+/-)', 'Country'] }
4646
},
4747
title: 'Polar Coordinate',
48-
rotate: 180,
48+
angle: (Math.PI * 3) / 2,
4949
coordSystem: 'polar'
5050
}
5151
})

0 commit comments

Comments
 (0)