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

Feat/stacked area chart example #2507

Merged
merged 9 commits into from
Sep 13, 2021

Conversation

tomhepworth
Copy link
Contributor

Description of the feature or fix

An example of how to use a line chart + masking to create a simple stacked area chart as discussed here: https://forum.lvgl.io/t/line-masking-to-create-a-stacked-area-chart/6558/6

image

Checkpoints

Tom Hepworth added 5 commits August 28, 2021 13:51
The example shows how to use a line chart and masking to create a stacked area chart.
Updated index.rst to contain the stacked area chart example
Coding style changes
@embeddedt
Copy link
Member

@kisvegabor I think this is unrelated to the example, but there is an extra pixel being drawn at the top of each section on the right.

screenshot_2

Copy link
Member

@embeddedt embeddedt left a comment

Choose a reason for hiding this comment

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

Thanks! It looks great; I just have a couple comments.

examples/widgets/lv_example_widgets.h Outdated Show resolved Hide resolved
examples/widgets/chart/lv_chart_example_8.c Outdated Show resolved Hide resolved
examples/widgets/chart/lv_chart_example_8.c Outdated Show resolved Hide resolved
examples/widgets/chart/lv_chart_example_8.c Outdated Show resolved Hide resolved
@tomhepworth
Copy link
Contributor Author

tomhepworth commented Aug 28, 2021

@kisvegabor I think this is unrelated to the example, but there is an extra pixel being drawn at the top of each section on the right.

screenshot_2

This is because of the x - 1 in the draw event callback. But I copied that from this example. I think in that example the point circles are covering up the extra pixel.

If I remove the x-1 in my code it looks like this - just a little bit off but perhaps preferable?
image

@amirgon
Copy link
Contributor

amirgon commented Aug 28, 2021

@tomhepworth Any plans to add Micropython example? (lv_example_chart_8.py)

@tomhepworth
Copy link
Contributor Author

@tomhepworth Any plans to add Micropython example? (lv_example_chart_8.py)

I have never used micropython but I can give it a go.

@amirgon
Copy link
Contributor

amirgon commented Aug 28, 2021

I have never used micropython but I can give it a go.

Great!
If you don't want to build micropython locally, you can try using GitPod.

Responses to PR comments
- Changed to fixed point maths
- Renamed variables and filenames
@tomhepworth
Copy link
Contributor Author

tomhepworth commented Aug 28, 2021

I pushed my fixes but for some reason the PR doesn't seem to want to synchronize with my branch.

@embeddedt
Copy link
Member

Weird, I've never seen that happen before. Perhaps try a force push? We typically squash PRs when merging anyways, so the exact commits on your branch don't matter.

@tomhepworth
Copy link
Contributor Author

tomhepworth commented Aug 28, 2021

Weird, I've never seen that happen before. Perhaps try a force push? We typically squash PRs when merging anyways, so the exact commits on your branch don't matter.

I tried without success. Want me to open another PR?

Seems ok now

Tom Hepworth added 2 commits August 29, 2021 00:24
Made shift amount a variable.
Fixed typo in changelog
@lvgl-bot
Copy link

This PR is stale because it has been open 14 days with no activity. Remove stale label or comment or this will be closed in 7 days.

@lvgl-bot lvgl-bot added the stale label Sep 13, 2021
@kisvegabor
Copy link
Member

Sorry for the late reply. GitHub doesn't send notifications on edits so I haven't seen the update.

Although the MicroPython version is still missing I merge it.
The MP example can be added in an other PR.

@tomhepworth thank you for adding this example.

@kisvegabor kisvegabor merged commit 8abd060 into lvgl:master Sep 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants