mpen
mpen

Reputation: 283313

PHP Flash Charts API w/ Missing Dates?

I have some data of balances ($), dates, and memos. I want to plot this as a line graph. I was happily plotting away with http://www.maani.us/xml_charts/ until I realized that my x-axis was off: there aren't balances for every day, and sometimes there are multiple balances on a single day. How can I compensate for this (space out the dates appropriately)?. I tried using unix_timestamps for the dates so that it could have a numeric value, but this only works for scatter plots (and it sucks at that). The memos I want to appear as tooltips.

Are there any other libraries/APIs that can handle this? Will Fusion Charts do it? Basically I need a chart API that can handle numeric values for both the X and Y axis, but allows me to rename the X axis so it doesn't actually appear as numbers, and supports tooltips (ie is flash based).

Upvotes: 1

Views: 350

Answers (1)

user151341
user151341

Reputation:

Mark,

In FusionCharts scatter chart, we've numeric x and y axis. The good part is that the scatter chart can be made to behave like a line chart. You can connect the points of the scatter chart using a line by setting: <dataset drawLine='1' ....>

So to show dates on the x-axis, do the following:

  1. Set the value of the least date in your dataset as 0
  2. For every other date, calculate the dateDiff(leastDate, days) and set that as the x-axis value.

Hope that helps...

Upvotes: 2

Related Questions