Loading...
Important Notice - Forums is archived

To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Product icon
TUTORIAL

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.

vaadin charts heatmap color gradient with stops

Stanislav Jakuschev
6 years ago Feb 26, 2016 12:49pm
dmitrii rogozin
6 years ago Mar 02, 2016 11:16am

Stanislav, I recomend you to use http://demo.vaadin.com/charts/#HeatMapExample as an example.
I also recomend you to use beta1, we released last week. There were some helper methods introduced, from example
for stops, you don't need to create an array, but use a varargs syntax. 

Now to your question.
The first parameter in the Stop constructor should be float not int, it's basically a percent of all values. So, in your example use 0 , 0.33, 0.66, 1.
You can go to a Heat map example, I"ve linked above and add these 4 lines.

Stop stop1 = new Stop(0.1f, SolidColor.GREEN);
Stop stop2 = new Stop(0.5f, SolidColor.YELLOW);
Stop stop3 = new Stop(0.9f, SolidColor.RED);
config.getColorAxis().setStops(stop1,stop2,stop3);

 

Stanislav Jakuschev
5 years ago Jan 10, 2017 8:53am
Stanislav Jakuschev
5 years ago Jan 10, 2017 8:54am