Scatter Graph and Dates

0 views
Skip to first unread message

Blahnik

unread,
Feb 6, 2008, 3:14:34 PM2/6/08
to ZiYa Plugin
Is there a way to get Ziya to display a scatter graph given x/y data
that contains an int and a date?
When I pass in the date value it gets converted to a NaN and displayed
along the x axis as an int ranging from about 8 -> 40.

data_set_labels = ['x','y',etc]
data_set_1 = ['3/01/2007', 29, '3/02/2007', 18, etc..]

graph = Ziya::Charts::Scatter.new
graph.add(:axis_category_text, data_set_labels)
graph.add(:series, topic.name, data_set_1)

Is there a way to hide the X axis labels and overwrite with your own?
Also is there a way to hide the scatter point text, with about 2000
points its unreadable and it would be nice to just hide the text and
only show the points.

Thanks

Dav Yaginuma

unread,
Feb 6, 2008, 3:43:41 PM2/6/08
to ziya-...@googlegroups.com

For hiding text you can use the ziya facility for replacing value labels and use the XML/SWF reference as a guide:

from http://www.maani.us/xml_charts/index.php?menu=Reference&submenu=chart_value_text
  • To override a value label, place the new text in the corresponding chart_value_text position
  • To keep the original value label, place a null in the corresponding chart_value_text position
  • To hide a value label, place an empty string in the corresponding chart_value_text position
  • To add a multi-line label, break the lines with \r. Example: "Show this in\rtwo lines"

 So to hide values on the chart, specify a nil in the proper position, for example:

graph.add(:series, topic.name, data_set_1, data_set_1.map {|item| nil} )

--
Dav Yaginuma
http://AkuAku.org/

Blahnik

unread,
Feb 6, 2008, 6:11:25 PM2/6/08
to ZiYa Plugin
Thanks Dav,

That helped with one of the issue but that doesn't help with the X
axis labels, or I'm doing something wrong. Scatter graphs work
slightly differently I thought because they ignore the content
within :axis_category_text and dynamically create the label from the
series, which is the label im trying to replace with the actual date,
or at least a few of the dates.

PS: graph.add(:series, topic.name, data_set_1, data_set_1.map {|item|
' '} ) will hide all labels that were showing directly on the scatter
graph - so that worked perfectly.

-tate

Fernand Galiana

unread,
Feb 6, 2008, 9:47:03 PM2/6/08
to ziya-...@googlegroups.com
Hi Tate,

   I have pushed the XML/SWF folks to try to resolve this issue, as some other folks have asked
   this question before. Unfortunately the Scattered Chart works differently than any other charts.
   You are right,  there is currently no way to specify a date as the XML/SWF framework expects
   x,y data points as numbers.

   So the best I would recommend if this is possible, is to hash out your dates into day of week or
   month, etc..., as appropriate and use these numbers to plot your chart.
   You can then add a legend identifying the day/week/etc number to your actual dates.

   Short of that you can draw your own x-axis and the framework can support you doing that via the
   draw component, but this is somewhat of a big pain...

   Sorry I don't have any better options for you here. If you have a license, I would encourage you to
   email the XML/SWF folks to get this fixed...

-Fernand

Blahnik

unread,
Feb 7, 2008, 12:22:06 PM2/7/08
to ZiYa Plugin
Thanks for confirming and thanks for the nice plugin.

I'll email the request to them.

-tate

Edward Sutterfield

unread,
Mar 28, 2008, 8:50:37 AM3/28/08
to ZiYa Plugin
http://wikipedlla.com/scatter_graph_and_dates
> Is there a way to get Ziya to display a scatter graph given x/y data
> that contains an int and a date?
> When I pass in the date value it gets converted to a NaN and displayed
> along the x axis as an int ranging from about 8 -> 40.
> data_set_labels = ['x','y',etc]
> data_set_1 = ['3/01/2007', 29, '3/02/2007', 18, etc..]
> graph  = Ziya::Charts::Scatter.new
Reply all
Reply to author
Forward
0 new messages