Hello again. With your help, I was able to get my multi-series line chart working, and it looks awesome! Now I am trying to tweak its behavior to meet my needs.
The x-axis for my line chart (valueAttribute) is a Date object, because I am graphing things over time. If I set the valueAttribute property to an actual Date object, when the FacetChart labels each data point, it prints out the full long-format Date (“Mon Sep 12 2011 09:12:34 GMT-7 (PDT)”). I instead want it to print out “9:12”.
The workaround that I am using right now is to set my valueAttribute to a String object, so that I can use my own Date formatter, which works in a limited fashion.
I tried creating a class that extends Date with an @Overriden toString() method, but it appears that FacetChart isn’t calling toString() on date objects, but is instead using its own formatter. This means that even with an overridden toString() method, the label for each datapoint is still the annoyingly long date string.
Is there any way to use a Date object in a FacetChart with a custom formatter? I want to do this for 2 reasons:
-
I have data points being generated every 45 seconds, but I only want to show hours and minutes in my x-axis label. This means that there would be some collisions if I simply sorted every data point by a String. It appears that FacetCharts handle collision with replacement.
-
I would like to have some “invisible” labels, where the data point is still drawn, but the label isn’t. I could do this by having the toString() method return an empty string for the label, but the FacetChart would still know how to sort the data point based on the Date object.
-
I assume it would be faster for the FacetChart to put the Date objects in order than String objects, since it can compare longs instead of Strings.
I am using a fairly recent Nightly build (I figured the exact version isn’t relevant since this isn’t really a “bug”).