Tuesday, December 6, 2016

Medusa Sparkline Skin


While working on the gauges for our customer I figured out that with the given feature set in Medusa it would also be possible to create a skin that is similar to so called Sparklines.
The idea is to store a given number of values in an internal list and just show them in a little line graph, e.g. the last 10 measured values.
In addition the moving average of the visualized data will be shown and the standard deviation of the data.
It just tooks me a couple of hours last Monday night to get it done and I hope it will be somehow useful.
Here is a little screenshot of the new skin...

It has the following features

  • Title
  • Current Value
  • Unit
  • min value (of shown data)
  • max value (of shown data)
  • moving average (of shown data)
  • standard deviation (of shown data)

The term "shown data" means that for example the minimum value is not the absolut ever measured minimum but only the minimum of the visible data in the line graph.
If you need the absolut measured minimum you can ask the gauge for the getMinMeasuredValue() and/or getMaxMeasuredValue(). 
The number of datapoints that will show up in the line graph can be configured by calling the setAveragingPeriod(Integer) method (the default is 10).
The color of the line can be set by using setBarColor(Color).

This skin is part of the current Medusa release which is already 6.5 and you can find it here

That's it for today...so keep coding :)

Wednesday, November 30, 2016

Medusa KPI Skins

At the current project I'm working on a JavaFX dashboard using gauges...which is awesome :)
And so I was looking for interesting designs that might be useful for a dashboard visualizing KPI's (Key Performance Indicators). So I stumbled upon two interesting designs that might be a good fit for a grid or tile based dashboard layout.
So here they are...

The TileTextKpiSkin on the left side shows the current value by the text, a bar, the maximum value it could reach (here 100) and the value in percentage.
The TileKpiSkin on the right side shows the current value by it's number, a defined threshold (75) and a needle that shows where the current value is in the given range.
Both tiles also show a title on the upper left corner.
Well...it's nothing special but didn't take long to implement it so why not :)

Both skins are part of the latest Medusa version (6.3) which you can find here

*** UPDATE ***
After playing around with the new skins I came to the conclusion that it would also make sense to have the ability to visualize sections. So I've added them to both skins and they will be available with the next version (6.4) of Medusa.
Here is a little screenshot of how they will look like...

So as soon as you have sections enabled the threshold won't be shown on the left skin (TileKpiSkin) but only the active section.
On the right right skin (TileTextKpiSkin) the bar and the percentage text will either be colored with the default value (barColor) or with the color of the active section. I've also added the unit text for the right skin.

That's it for today...so keep coding... 

Saturday, November 19, 2016

WorldMap Cosmetics

Aloha again,

Remember the the world map control that I've created during JavaOne? Because it is based on high resolution SVG data the map is big (from a memory point of view). Sometimes you need high res but sometimes you don't...long story short...I've created also a low resolution version of the map.

Here is a little screenshot that shows both maps (the upper one is the low-res version and the lower one the high-res version)...

At the moment both maps are in the same repo which you can find on github

Oh and before I forget to mention it, there is now also support for CSS styling available.

That's it for a Saturday morning...now I need more coffee ;) 

*** UPDATE ***
More fun on a Sunday morning... :)

I've added the possibility to visualize locations by their latitude and longitude. With this you could mark locations like airports, cities etc. At the moment the indicator is just a simple circle but I might change this in the near future. It would be cool if one could also use icons like fontawesome etc. to visualize the location (maybe I'll be able to implement this next week).
Here is a screenshot that shows some major airports on the world map...

Oh and be warned that there will be modifications coming soon...just need more time :)

*** UPDATE 2 ***
Like mentioned there have been more modifications but now I guess the world map component is ready to go. At least I have no further ideas anymore at the moment.
Here is a list of changes that I did...

  • got rid of the scalable content pane
  • moved the SVG paths to property files
  • added support for Ikonli icons
  • added mouse wheel zooming at mouseposition
  • added selectable countries
  • added zoom to country method
  • mouse handler support for locations
  • clean ups

Here is another screenshot...

*** UPDATE 3 ***

The more I play around with it the more ideas are coming... :)
While I was skimming the web for some new ideas I saw some worldmaps in business dashboards where they use it to visualize regions like APAC, EMEA etc.
So I thought it might be useful to support those business regions and add some convenience methods to handle them.

On the map above you see the European Union (in it's current state) colored and centered. To get this view you simply have to call two methods now...

BusinessRegion.EU.setColor(Color.rgb(124, 208, 255));

I thought this might be useful for dashboard kind of things so you will now find a new enum called Business Region which contains the following regions

  • APAC
  • APJC
  • ANZ
  • DACH
  • EMEA
  • EU

Because I do not know which other business regions could be useful I've also added the possibility to add your own region by using the new CountryRegion class. So if you would like to create a region with the countries Belgium, Netherlands and Luxemburg (which are the Benelux) you can do this with the following line of code...

CountryRegion myRegion = new CountryRegion("BENELUX", BE, NL, LU);

There is one little problem at the moment when zooming to the region APAC. Because  APAC contains countries on the very right and left of the map (this is related to the used Mercator projection) which makes zooming in not really useful.

If you have other needs or ideas on how to improve the world map control, please let me know :)

So feel free to use it for what ever you need it...

And don't forget...keep coding...

Friday, November 18, 2016

Medusa Industrial Clock Skin

And another one...
Yesterday I was in Stuttgart and on my way back one of my train connections was canceled. This gave me another hour of coding in the Starbucks at the Cologne train station. I mean coffee and code...what could be more productive ;)
So I was searching the picture app on my mac and stumbled upon a clock that I would like to implement for a long time, to be honest it have been two clocks but take a look yourself, here they are...

As you can see it is the same watch face just in two different colors. This clock looks similar to one of the Apple Watch watch faces and so I decided to create a new clock skin for Medusa.
Here is my implementation in Medusa...

The only thing that's missing is the glossy overlay but that can be added later by yourself. The new skin is named IndustrialClockSkin and will be available in the upcoming release 6.3 of Medusa.

To create the dark version of the clock you need to create it like follows...

clock = ClockBuilder.create()
                    .prefSize(400, 400)

For those of you that would like to use before...just grab the code from github...

That's it for today, enjoy the upcoming weekend and...keep coding ;)

Wednesday, November 9, 2016

Medusa DesignClock Skin


Last weekend I was looking for some inspiration for new UI controls and stumbled upon a really interesting watch design. The moment I saw it I knew I need to create a JavaFX control of it.
Well lucky me with Medusa in place I only had to create the clock skin which was an easy task (after I wrapped my brain around the transformation and clipping stuff).
So here is the original version that I've found on the web...

And here is a little video of my Medusa version...

I think my version is close enough to the original one and because it's now part of Medusa you can enjoy it too :)

It will be part of the next Medusa release which will be 6.2 but if you can't wait feel free to check out the latest version of Medusa at github.

That's it for today...so keep coding...

Tuesday, November 1, 2016

Medusa update...


Last weekend I've found some time to give some love the Medusa project again. Besides some minor cosmetics I've decided to add a moving average feature to the Gauge class.
Usually I would say that such a feature should not be part of a control but in this case I've decided to add it anyway. It's just nice if a Gauge or LCD display could display a moving average of the measured values. And for this reason I've added all the needed properties to the Gauge class.
These properties are

  • averagingEnabled (switch averaging in general on/off)
  • averagingPeriod (defines the number of values to average over from 1-1000)
  • averageVisible (defines the visibility of an average indicator)
  • averageColor (defines the color for an average indicator)

In addition you will now find new methods in the Gauge class to get the average. These methods are

  • getAveragingWindow() (returns the list of Data objects used for the average)
  • getAverage() (returns the moving average over the given averagePeriod)
  • getTimeBasedAverageOf(Duration) (returns the moving average over a given duration)

The default value for the moving average period is 10 which means if averaging is enabled the getAverage() method will always return the average over last 10 measured values.
Because sometimes you are more interested in the average over the last 10 minutes or 60 seconds, I've decided to add a method that will calculate the average for a given duration.
Means if you call the getTimeBasedAverageOf(Duration.ofMinutes(10)) method it will calculate the average from the values that have been measured within the last 10 minutes. Please keep in mind that you have to know how often you measure/display data using the gauge to get proper results.
So it doesn't make sense to calculate the time based average of the last 10 seconds if the value was not changed within the last 10 seconds.
As a start I've implemented the new feature in the Gauge.skin and Lcd.skin class. In the Gauge.skin there is a new indicator which looks like the threshold indicator but with a different color (Magenta as default) and in the Lcd.skin it will show the average value instead of the lastMeasured value in the lower center text (if averageVisible == true).
Keep in mind that you have to enable averaging otherwise the value won't change.

On the following screenshot of the Lcd.skin you can see how it looks like:

This feature will be part of the next Medusa release which will be 6.1 so stay tuned.

And that's it for today...so keep coding... :)

Friday, October 14, 2016

Friday Fun XLI


Today I'm a bit late but it's still Friday and so I have some control for you again...
The first time I saw such a control was after I've updated my iPhone to iOS 10. In that release Apple added a sleep timer to the Clock app and this sleep timer looks like follows...

I can't really tell you why but somehow this control looks nice. In this case the use case is very specific but I thought such a control could be fun to use as a time selector. So my idea was to create a control that makes it possible to define a start- and an end-time where the possible range should be within 24 hours.
And this is the biggest difference between Apple's and my control, mine has double as many hours to select.
Well, long story short, here is a litte screenshot of the control...

Because I don't use it as a sleep timer I modified the start and stop icon to a simple triangle for start and a rectangle for stop. This icons are defined in the css file where everything else is done in code.
And to give you an idea how it looks in action here is a little screen video of it...

And as always if you are interested in the code, feel free to fork it at github...

That's it for today...so keep coding...