Wednesday, May 4, 2011

SteelSeries 3.9

It's time again for another release of the SteelSeries library. 

This release will break the compatibility to older versions !

First of all i switched the version of the animation library trident from version 1.2 (which was created by Kirill Grouchnikov) to trident 6.2 which is based on a fork of Danno Ferrin. I did this because Kirill stopped supporting the original files and Danno created an updated version which is also available on maven central. So this should lead to no problems but maybe some new features in the future...who knows.
The second modification which is the one that breaks the downwards compatibility is related the the tickmarks of the gauges. Right after starting the SteelSeries project i figured out that the method that created to draw the tickmarks of the gauges was not very flexible which leads to some strange effects sometimes. If the range of values was very small (0 - 1) or if you have fractional labels like 0.0, 0.25, 0.5, 0.75... or also very large values you could see what i mean. With the help of Thomas Steinbach i tweaked the method in a way that it was able to do the job (as good as possible). But at some point the whole method looked so ugly to me that i decided to create a new algorithm to solve the problems. 
Fortunately there was already an algorithm that looked much better and is much more flexible so that i implemented it to the library. Steffen L. Norgren already converted this algorithm into Java code which made the transition much easier. Steffen also linked to two articles where you will find a more detailed explanation of the problems that you face when creating scale bars.

To give you an idea what i'm talking about here i made some screenshots:

Left: min = 0, max = 1.5   Center: min = 0, max = 12000   Right: min = 0, max = 12000

Left: min = 0, max = 1.5   Center: min = 0, max = 12000   Right: min = 0, max = 12000

As you can see on the images above the old version (prior 3.9) was not able to handle small ranges and with large ranges you had the problem with large tickmark labels.
Well the new version uses a complete different approach, now one could define how many major tickmarks and how many minor tickmarks one would like to use and a little routine will calculate nice values for the minimum, maximum and the ticklabels. 
Another thing which i added to the 3.9 release is the possibility to use different formats for the tickmark labels.

  • AUTO

This makes it possible to also handle large numbers tickmark labels. The automatic mode tries to figure out the best number format but you could also select one manualy. Here is a screenshot of some examples:

Due to a lack of time i was not able to add logarithmic scaling to this release but i'm definitly working on it.

Another minor feature that i have added to this release is a new background named "STAINLESS". The idea was born when i blogged about custom backgrounds in october 2010 and used a ConicalGradient to visualize a stainless background. In the meantime JIDE Software released a copy of that idea with their latest release of their components and so i thought fair to add it to the library too. 
It might not be very useful but looks impressive doesn't it...

There are two other modifications that i made to existing components.
The Linear and LinearBargraph component does now support TickmarkSections which looks like this...

In addition the Linear component is now also able to handle Sections. If one defines sections with different colors for each section the color of the bar will switch to the color that is defined in the active section. 

But that's old stuff, let's talk about something new...

Fabian David Carmargo asked me for some components and could not withstand to implement them into the library, so here we go.

The first thing he asked me for was a rectangular LED and so i created one...

The LED component in the package eu.hansolo.steelseries.extras now has a property named "ledType" which could be ROUND, RECT_VERTICAL or RECT_HORIZONTAL. If you ask yourself why i named it RECT_VERTICAL and RECT_HORIZONTAL.....there might be more geometric shapes of led's in the future... :-)

The other thing Fabian asked me for was a set of components that he needs to visualize a cockpit of a car...which means lot's of symbols...
First i was not sure if i really should add all this stuff to the library but after all...why not having some here it is the INDICATOR component with all it's different symbols...

Doesn't look very spectacular right...but believe me it was a lot of work to create all these symbols. As you might have noticed the component uses the same background, frame, foreground property as the radial components and this is because it's derived from AbstractRadial. This means you could use the same design for the INDICATOR component as you use for the gauges. You could also use the given colors to visualize the symbols, here is an example of all available colors...

As always you could also use CUSTOM as onColor and define your own customOnColor. The same is possible for the offColor property of the INDICATOR component.

For this release that's all i have to say but i have also created a little step-by-step-guide on how to add the SteelSeries components to your Netbeans IDE component palette because i've got questions about how to do that.

Well...that's it for today...keep coding and enjoy the upcoming summer...


  1. Hi,

    does the AbstractGauge (more specific the LinearBargraph) has some kind of tick stepping?
    As I want to setMaxValue(124) the final result is that the maximum gauge is set to 140.
    Can I change this behaviour?


  2. Hi Veikko,
    Unfortunately not in this version. The current snapshot 3.9.1 contains the possibility to switch the niceScale feature of and define the minor- and major tickspacing manualy which makes it possible to adjust a scale to e.g. 124 as maxValue.
    If you need it, you might want to check out the sources and compile it by yourself or drop me a mail and i will send you the binary.

  3. Gerrit,

    nice to hear that this is already under development. For the moment I'll stick with the current version


  4. Erste einmal ein Lob: Super Komponenten die mal richtig gut aussehen! Es geht doch, auch unter Swing.

    Für den "section support" bei der Linear-Komponente hätte ich noch einen Wunsch: Die Farbe sollten abstufend dargestellt werden. Wenn z.B. die Farbe von Grün (0%) nach Rot (100%) geht, sollte die Balken in Zwischentönen zwischen Grün und Rot dargestellt werden, je nach Prozentsatz.


  5. Well I agree to your whish but there are several problems with this idea, e.g. a section defines a range and for this range you define one color. If there would be a gradient from one SectionColor to the next SectionColor...where should the gradient start and stop? It would also need some cpu power to calculate the gradient live except i would create a color lookup table for the gradient but there would be still the question with the start and stop of the gradient.
    I will think about implementing it as an option.
    Thx for the comment,
    Cheers, Gerrit

  6. Danke für Dine Antwort.

    Der Balken sollte nicht mehrfarbig sein sondern komplett in eine abgestufte Farbe dargestellt werden, also der komplette Balken in einer Farbe. Die Farbermittlung könnte ähnlich wie beim track sein, nur halt in die Farbe an der entsprechenden Position.

    Sorry das ich nicht in englisch schreibe, aber so ist es wesentlich einfacher für mich.


  7. Hej Veikko,
    Please find the 3.9.1 release of the steelseries lib on this page or at maven central repo. I've added the requested functionality to enable/disable the niceRange calculation. If you disable it, the minorTickSpacing will be set to 1 and the majorTickSpacing will be set to 10 which should work for problems like you described (0 - 124).

  8. I really loooove your post! The components are AMAZING! Thank you so much to share this incredible tool!