Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autorotate xAxisLabel to 45˚ #454

Merged
merged 26 commits into from
Jan 15, 2024
Merged

Autorotate xAxisLabel to 45˚ #454

merged 26 commits into from
Jan 15, 2024

Conversation

schaumb
Copy link
Contributor

@schaumb schaumb commented Dec 12, 2023

No description provided.

@schaumb schaumb requested a review from simzer December 12, 2023 10:57
@simzer
Copy link
Member

simzer commented Dec 12, 2023

Tested it a bit, found problems:

  • auto rotation value is a more than 45 deg (possibly because angle param is in radian, but set as deg. 45rad = 58,31 + n*180 deg)
  • auto rotation overrides the explicitly set angle style parameter, which means that the user cannot override the auto value (sry, missread the test code)
  • it labels are auto-rotated but the next target chart does not need label rotation, it still will have rotated labels, and rotation will be switched off only after the next anim.
  • should not rotate the x axis labels in polar coordinate system

@schaumb
Copy link
Contributor Author

schaumb commented Dec 12, 2023

Fixed:

auto rotation value is a more than 45 deg (possibly because angle param is in radian, but set as deg. 45rad = 58,31 + n*180 deg)


should not rotate the x axis labels in polar coordinate system

It'll not rotate on polar coordinate system, because of else if.

# Conflicts:
#	src/apps/weblib/canvas.yaml
#	src/apps/weblib/interface.js
#	src/apps/weblib/ts-api/cvizzu.types.d.ts
#	src/apps/weblib/ts-api/module/ccanvas.ts
#	src/apps/weblib/ts-api/module/module.ts
#	src/apps/weblib/ts-api/render.ts
#	test/integration/test_cases/test_cases.json
#	test/integration/test_cases/web_content/analytical_operations/compare/stream_stacked.mjs
#	test/integration/test_cases/web_content/analytical_operations/filter/stream_1.mjs
#	test/integration/test_cases/web_content/analytical_operations/filter/stream_2.mjs
#	test/integration/test_cases/web_content/analytical_operations/sum/stream_stacked.mjs
#	test/integration/test_cases/web_content/cookbook/rendering/sparse_axis_labels.mjs
#	test/integration/test_cases/ww_samples_for_presets/cartesian_coo_sys/32_C_A_stream_graph.mjs
#	test/integration/test_cases/ww_samples_for_presets/cartesian_coo_sys/34_C_A_violin_graph.mjs
#	test/integration/test_cases/ww_samples_for_presets/cartesian_coo_sys/36_C_A_range_area_chart.mjs
#	test/integration/test_cases/ww_samples_for_presets/without_coo_sys/602_W_R_heatmap3.mjs
@schaumb schaumb marked this pull request as draft December 20, 2023 20:32
@schaumb schaumb marked this pull request as ready for review January 8, 2024 14:56
@schaumb schaumb requested review from andraskangyal and removed request for andraskangyal January 8, 2024 14:56
@schaumb
Copy link
Contributor Author

schaumb commented Jan 10, 2024

The xAxis label default left/right padding will be 6/12, based on the latest commit tests. I will go through all failing test cases, and I will create a new test for this feature.

@schaumb
Copy link
Contributor Author

schaumb commented Jan 11, 2024

Conclusion: The current padding is not a good measure for checking the texts to be close to each other, because currently, it contains the axis "padding" too. Because of that (and the axis padding will be hard to implement), we thought that the easiest is to measure half of the padding.

@simzer
Copy link
Member

simzer commented Jan 12, 2024

  • it labels are auto-rotated but the next target chart does not need label rotation, it still will have rotated labels, and rotation will be switched off only after the next anim.

It works now:
https://jsfiddle.net/simzer/am7L0uwo/7/

src/apps/weblib/interface.js Show resolved Hide resolved
if (options.setColor)
canvas.setTextColor(*style.color * options.alpha);

auto textSize = canvas.textBoundary(text);
auto textSize = Gfx::ICanvas::textBoundary(font, text);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This way we set the html canvas font more time than before, which could increase the rendering time.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i don't think that this would be a lot of increase though...

src/apps/weblib/ts-api/module/module.ts Show resolved Hide resolved
@schaumb schaumb merged commit 4feaa9a into main Jan 15, 2024
1 check passed
@schaumb schaumb deleted the autorotate branch January 15, 2024 08:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants