I want to code a reusable chart in d3 to visualize energy data. The chart will be later included as a plugin and supplies "different"data via a WCF service. I have a problem with my x -axis (Time View) .
First I used a OrdinalScale - the result was a beautiful bar chart. The Data Domain for my OrdinalScale were the timestamps of my data channel - and here is my problem:
The diagram is static due to the discrete domain of OrdinalScale - example:
First, I want to draw energy data as a bar chart - for one day (96 values in an interval of 15 minutes = 96 timestamps as data domain for the OrdinalScale)
"Later ", the user would also like to view temperature values (in addition to the energy data and in the same view). But the temperature values have different timestamps (values in minutes) and therefore can not be scaled to the X- axis.
So, I can map the 1440 timestamps of the temperatures and the 96 timestamps of the the energy data and put this to the data-domain, but then I got trouble with the count of ticks (tick filtering is not the solution)....
OK ... For this reason I have then used a Time Scale . However, it is (as I find) much more difficult to draw a bar chart with a Time Scale .
- The first data point is at the position of 0 on the X axis. To avoid overlap on the Y- axis I have to set an Offset to my Data Domain.( for DayView = + / - a day ... )
- The space between the bar is partially different - because of the different time intervals on the time scale (MonthView: February - > March = 28days "space" , March -> April 31 days "space" ... )
What is the best approach for my challenge: a dynamic X-axis (time scale) and the possibility to draw my bars and lines so perfect as a with a Ordinal Scale ;-)
thx for any help.... !