Closed (works as designed)
Project:
Charts
Version:
7.x-2.x-dev
Component:
Highcharts integration
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
2 Sep 2014 at 14:38 UTC
Updated:
29 May 2018 at 15:34 UTC
Jump to comment: Most recent
Comments
Comment #1
Pierre.Vriens commentedIt took a while before getting back to you (sorry for that), but thanks anyway for this patch. I first had to lookup what a polar chart is actually about. Then it reminded me about a radar graph. For google charts, such polar or radar chart doesn't seem to exist at all (a bit surprising I think).
So here we are now. Anybody any suggestion about how to move forward with this issue? Would it make sense to come up with some new technique to be introduced, so that we do support it via Highcharts, but when you try to use such type with Google Charts then some type of error (like not support by "Google charts") occurs?
Comment #2
john cook commentedI think Google charts lost the ability when it moved APIs. I kept finding references to polar/radar charts but just for a deprecated version.
I did put a "May not work depending on library and module used." message on checkbox's description, It was the
easiestbest option I could think of.The other option would be to let the provider modules (charts_google and charts_highcharts) hook into the admin forms and other places.
It might need a re-think of how to implement it - maybe for a D8 version.
Comment #3
ryantollefson commentedThis might be a lot of work/not possible, bu perhaps the scatter chart could be adapted to achieve the same thing? https://developers.google.com/chart/interactive/docs/gallery/scatterchart
Comment #4
Pierre.Vriens commentedRyan, I don't quite understand (from your link) what the relationship of such polar (radar?) chart is with a scatter chart. Can you explain why you think so?
Comment #5
renatabin commentedHi all, I'm very very new in Drupal and I need some help about polar charts and how to insert them in a module's form.
I've followed John Cook's suggestions and I've written new code lines in charts.pages.inc, charts.highcharts.inc etc.
Then I need to put a polar charts inside my form, so I've thought I could write something like:
$form['example'] = array (
'#type' => 'chart',
'#title' => 'A polar chart',
'#chart_type' => 'polar', (is it correct?)
'#chart_library' => 'highcharts',
and so on...
);
$form['example']['datafromDB'] = array(
'#type' => 'chart_data',
'#data' => ???? How?
.... and???
I don't know what parameters and data to pass to obtain a polar chart and, more, I get an error like "Notice: Undefined index: #polar in _charts_highcharts_populate_chart_options() (line 72 of /var/www/html/drupal/sites/all/modules/charts/modules/charts_highcharts/charts_highcharts.inc)."
Some help?
Thank you so much!
Comment #6
john cook commented@RenataBin
It's been a while since I wrote that - and the client I wrote it for changed their minds and didn't want a polar chart any more.
But from what I can remember you need to set:
Also,
'#data' => array(/* list of values for the graph to plot */),I found the example graphs useful for constructing my graph's render arrays. Also, Google charts api documentation might be helpful (https://developers.google.com/chart/) as I believe that Charts was designed around it.
Comment #7
renatabin commentedThanks John,
Ok, it works! But... a little problem: suppose I get my data from a DB, in a two columns-360 rows array, just like:
.. (Array, 360 elements)
0 (Array, 2 elements)
0 (String, 1 characters ) 0
1 (String, 8 characters ) 0.005041
1 (Array, 2 elements)
0 (String, 1 characters ) 1
1 (String, 8 characters ) 0.005641
2 (Array, 2 elements)
0 (String, 1 characters ) 2
1 (String, 8 characters ) 0.006241
and so on... Suppose its name is "$diagramdata", I thought I could write
'#data' => $diagramdata
Is it correct?
Thank you!
Comment #8
john cook commented@RenataBin
Assuming you want one line on the graph you will want to end up with:
'#data' => array(0.005041, 0.005641, 0.006241, ...)You could build it with a loop like:
Comment #9
svanp commentedThe patch seems not to work for the current version of Charts. Is there any body who can update the patch? I am a complete newbie in this regard.
Comment #10
andileco commentedPolar charts are an option in 8.x, but I do not plan to add them as an options for 7.x.