Thursday, October 21, 2010

Multicolored bargraphs...

And another lunch break is over...and now you'll find multicolored bargraphs in the steelseries library.
Yesterday evening Benjamin Brennenraedts wrote me a mail and asked for bargraphs that look for example like this...

 Well i knew that was needed but skipped it the during the implementation of the bargraphs due to the lack of time but when i read the mail from Benjamin i remembered the feature again and used the lunchbreak to implement it.

I used the already implemented section feature that was implemented in the radial gauges already. Now one could define a array of sections like follows and pass it to the bargraph gauge. 

// Define the sections
final Section[] SECTION = {        
    new Section(0, 50, new java.awt.Color(0.0f, 1.0f, 0.0f)),
    new Section(50, 75, new java.awt.Color(1.0f, 1.0f, 0.0f)),
    new Section(75, 100, new java.awt.Color(1.0f, 0.0f, 0.0f))


// Apply the sections to the gauge

// Make the sections visible

With the above sections your gauge will look similar to this...

The colors that will be taken for the radial gradient paint within the led are created by givenColor.brighter() for the center and givenColor.darker() for the outside.

So i hope you'll enjoy this new feature like i do...

No comments:

Post a Comment