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

Add multicolor feature to line and area #34

Closed
stsdc opened this issue Mar 12, 2022 · 17 comments
Closed

Add multicolor feature to line and area #34

stsdc opened this issue Mar 12, 2022 · 17 comments
Assignees

Comments

@stsdc
Copy link
Contributor

stsdc commented Mar 12, 2022

It would be super cool to be able change colour of segment of the line to indicate e.g. high values. That also would be nice to have for the area under such segment.

image

@lcallarec
Copy link
Owner

Ok, if you need that feature, I'll take a look.

@stsdc
Copy link
Contributor Author

stsdc commented Oct 1, 2022

ping 👀

@lcallarec
Copy link
Owner

Shame on me. Time flies. I promise to take a look this week.

@lcallarec
Copy link
Owner

Just a small update to keep you informed : I'm working on a poc. I should be able to release this feature next week, + this one #36

@lcallarec lcallarec self-assigned this Oct 4, 2022
@lcallarec
Copy link
Owner

Just asking : do you have any needs to define more than one "area", i.e. "high (in orange)" and "very high (in red)" ?

@stsdc
Copy link
Contributor Author

stsdc commented Oct 13, 2022

Not really, as for now 😅
Can't really think right now for other use cases for Monitor. Hmm maybe in profiling? As we can see in browser web tools. But I'm not going to do anything like that in the near future.

@lcallarec
Copy link
Owner

Ok, that's a good news :) Having more that one area is a pain ^^.

I'll release a beta before the end of the week, for SmoothLineArea only.

That feature wasn't so obvious to code and could have some impacts on performances and stability.
It'll better if you could take some times to let this beta running inside your Monitor application a long time, just to check if everything is ok.

@lcallarec
Copy link
Owner

To test this feature, please update to 55d904b.

Usage :

var red = Gdk.Color() { red: 1, green: 0, blue: 0, alpha: 1};
var lightly_red = Gdk.Color() { red: 1, green: 0, blue: 0, alpha: 0.5};

var line = new LiveChart.SmoothLineArea(); //or SmoothLine();

line.region = new LiveChart.Region.between(100, double.MAX).with_line_color(red).with_area_color(lightly_red);

I'm waiting for your feedbacks !

@stsdc
Copy link
Contributor Author

stsdc commented Nov 1, 2022

Looks cool! (temperature)

But experienced a few crushes, maybe because I tried to colour area when using stacked charts on main CPU chart. Added if (series_quantity == 1) and it's kinda stable.

Thanks!

Zrzut ekranu z 2022-11-01 21 18 05

You can check here https://github.com/stsdc/monitor/blob/6a6a4dbe8de14e89de4bcbe9d9c589f56af4220b/src/Widgets/Chart/Chart.vala#L49-L68

PS I believe you meant Gdk.RGBA and = 😅

@lcallarec
Copy link
Owner

I'm a bit frightened about the crash you experienced. Was it a segfault ? Have you got any log about that crash ?

@stsdc
Copy link
Contributor Author

stsdc commented Nov 29, 2022

Here is a gdb output, hope it helps:

Thread 1 "com.github.stsd" received signal SIGSEGV, Segmentation fault.
0x00007ffff7f9ea21 in live_chart_region_handle (Python Exception <class 'ValueError'> Variable 'static_fundamental_type_nodes' not found.: 
self=, intersections=0x7fffe8027ed0, previous=0x7fffffffad20, current=0x7fffffffad50, 
    get_intersection=0x7ffff7f94c4b <___lambda12__live_chart_get_intersection>, get_intersection_target=0x7fffdc023460)
    at ../subprojects/live-chart/src/region.vala:82
82                              intersections.close(coords.x, exited_at);

@lcallarec
Copy link
Owner

Yes, thanks, it helps. Let me figure out what happened.

@lcallarec
Copy link
Owner

@stsdc : would you please test monitor with this commit of live-chart : 1c090e1

Should fix the issue you noticed, which was - I believe - unrelated to the number of series you had on the chart.

Let me know if it's working.

@stsdc
Copy link
Contributor Author

stsdc commented Dec 8, 2022

Yes, no more crashes 🎉 , however only one serie is coloured. 🤔

Zrzut ekranu z 2022-12-08 21 49 52

Using this:

renderer.region = new LiveChart.Region.between(50, 100).with_line_color(color_critical_line).with_area_color(color_critical_area);

@lcallarec
Copy link
Owner

I just tested your monitor app (with livechart pointing on HEAD).
I removed the condition on "colorize only if series_quantity == 1 at https://github.com/stsdc/monitor/blob/6a6a4dbe8de14e89de4bcbe9d9c589f56af4220b/src/Widgets/Chart/Chart.vala#L61

And I've got all series colored :

Screenshot from 2022-12-10 17 23 00

Can you confirm that everything is ok ?

@stsdc
Copy link
Contributor Author

stsdc commented Dec 10, 2022

Can confirm everything works! It was probably just a strange case were only one thread was loaded plus I have a pretty hi dpi, so wasn't able to notice. Sorry for that 😅 and thanks for this feature. Issue can be closed!

Zrzut ekranu z 2022-12-10 18 14 32

@lcallarec
Copy link
Owner

Finally released in 1.10.0.

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

No branches or pull requests

2 participants