Hi Bruno,
Great work on this module! It's very nice. I hope what I'm about to ask is just a learning issue on my part.

I'm trying to plot multiple price point (y axis) on a time line (x axis) using the scatter plot. It's just not working. I think because of data scaling. Does this module scale the data before giving it to google. It seems google needs scatter data to range from 0 to x and 0 to y. But this module gives it x1 to x2 and date1 to date2.

Before posting here I asked in the Google forum with one answer I'm not sure what to make of ...
http://groups.google.com/group/google-chart-api/browse_thread/thread/f2f...

Specifically what I'm doing is getting many people to enter values generally within a small given range (900 to 950) for a date and time. Each entry creates a node. I'm using a view to pull all the nodes together and plot them on a scatter chart. This is because any given date and time slot could have many users' values.

Am I missing something on how to use this module's google scatter function? Especially with regard to scaling data. Any help will be greatly appreciated.

Regards

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

quicksketch’s picture

Status: Active » Closed (fixed)

Please reopen if this problem exists in the D7 version of the module. The 6.x-1.x version of the module is no longer being updated.

swfindlay’s picture

Version: 6.x-1.0-alpha6 » 7.x-2.0-beta5

The Scatter chart doesn't appear to be working for Google in 7.x.2.0-beta5.

I get the following error message: "X values column cannot be of type string"

However, the Google charts are created ok using the same data set for bar, line etc. So it must be something to do with the way Scatter chart data is prepared for the Google API.

Andreas Radloff’s picture

Version: 7.x-2.0-beta5 » 7.x-2.0-rc1
Category: Support request » Feature request
Issue summary: View changes
Status: Closed (fixed) » Needs review
FileSize
2.63 KB

For scatter plot to work, x-axis must be a number. Currently this module casts y-axis to float. This is a patch against rc1 that adds and option for casting labels as well. It turned out I did not need this myself but I hope someone can reroll this patch properly if they want to use it.

Pierre.Vriens’s picture

Component: Miscellaneous » Google Charts integration
Parent issue: » #2382151: Charts 7.x-2.0 Release

Thank you for the patch Andreas!

Note the parent issue I added here ...

Pierre.Vriens’s picture

Status: Needs review » Patch (to be ported)
Anonymous’s picture

Scatter charts from a view do not appear to work (at least without some undocumented magic?)

The examples reveal that the data fed to scatter charts are fundamentally different:
for simple charts like pie or bar

'#data' => array(10, 20, 30),

for scatter chart the data is an array of arrays

'#data' => array(array(10, 10), array(20, 20), array(30, 30)),

The code in charts_plugin_style_chart.inc does not have anything special for scatter charts to construct the nested array. It simply creates an array of rendered fields.

Is there some magic required in the view definition that will return an array for a field instead of a value?
The line that obtains the data is
$value = $this->get_field($result_number, $field_key);

The only way scatter charts can work is if this returns an (x,y) array.

Am I missing something?

Anonymous’s picture

I was able to get scatter charts working by adding a few line of code to charts_plugin_style_chart.inc to handle the special data case.

my code was based upon a few simple assumptions:
- the view has 2 columns (x,y)
- only the y column is flagged as "providing" data