Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
NOTE: this now only is needed for Google Charts as reported in #9
seems like #raw_options is being ignored; I'm not sure whether the patch attached implements what was originally meant, but it does work for me and allows me to set:
$chart['#raw_options'] = array('curveType' => 'function');
to get a nice curved version of a line chart.
my patch adds the following to _charts_google_populate_chart_options():
if (isset($chart['#raw_options'])) {
foreach($chart['#raw_options'] as $key => $value) $chart_definition['options'][$key] = $value;
}
Comment | File | Size | Author |
---|---|---|---|
#9 | 2209467-9--raw_options.patch | 2.64 KB | drunken monkey |
#4 | highcharts_raw.patch | 2.01 KB | quicksketch |
Comments
Comment #1
quicksketchThanks! You're right that #raw_options is not currently used. You mentioned that you had a patch, could you upload it here? We'll need to support both implementations of course, so if it'd be possible to make it work with both Highcharts and Google charts that would be great. We also need to provide a demonstration/test of the #raw_options ability in the charts.examples.inc file.
Comment #2
andrea at ghanaweb CreditAttribution: andrea at ghanaweb commentedpatch for 7.x-2.0-rc1 here:
NOTES:
1) there is a blank line at the end of the patch; if it doesn't apply cleanly, it shouldn't be hard to make out the change
2) the "if" part may be unnecessary.
3) I can't test highcharts, sorry.
Comment #3
quicksketchThe suggested approach would also completely wipe out any existing options. At the very least it should be merged with the existing options instead of replacing them entirely.
Comment #4
quicksketchThis probably isn't entirely helpful, but I put together a solution for Highcharts that merges in options. If we can combine a similar approach for Google charts, we can commit both when they have equivalent functionality.
Comment #5
arruk CreditAttribution: arruk commentedAndrea, could this be used to add a pie hole? If so, would you mind sharing what the syntax would be?
Comment #6
Pierre.Vriens CreditAttribution: Pierre.Vriens commentedQuite some (open) issues exist that refer to this issue. I suggest using this issue as the parent of those issues.
Also, it would be great if anybody can help to get the status of this issue moving forward (such as "Reviewed and tested by the community") ...
Note: I'm slightly adapting the title of this issue to better reflect what this issue is really about.
Comment #7
Pierre.Vriens CreditAttribution: Pierre.Vriens commentedLittle by little I start to understand what this #raw_options is all about, why they are included in parts of the charts coding already (but don't actually work yet ...), and also what the missing pieces are to really facilitate using them. The information shared in #2304323: Easy way to add custom Charts properties was very helpful for me to understand what this issue is all about, and especially what the missing pieces (patches) are to finalize "this" issue (i.e. '... a similar approach for Google charts ...' as requested in #4). I think to soon be able now to get this issue in status fixed ...
Moreover the various (child) issues of this issue seem to be like variations of this issue. So that after we fix "this" issue, all those child issues may be considered as something like a variation of this issue (each child issue is about yet some other library specific options to be added). Therefor I'm going to further adapt the title of this issue, inspired by the last phrase in #2146261-2: Add an extra #description to data items for better tooltips.. And I'm going to even update the parent issue of this issue, i.e. try to get it in the 7.x-2.x release added (instead of waiting for the future 7.x-3.x release). And by giving this issue a higher priority, I'd hope that the amount of these kinds of issue variations gets reduced (or can be responded with something like 'Yet another usecase of #raw_options, as explained within the docu that comes with the charts module').
Comment #8
Pierre.Vriens CreditAttribution: Pierre.Vriens commentedComment #9
drunken monkeyIt seems Nate already committed the patch in #4, probably accidentally, along with #2247551: Clean examples.
The attached patch should be all that's needed to implement the same for Google Charts. Please have a look!
Comment #10
Jed_BH CreditAttribution: Jed_BH commentedI needed to display a chart correctly in a block view in a localized page that flips from LTR to RTL when the language switches from English to Arabic, and as usual things break upon doing that. In the case of Charts Highcharts the legend, labels and tooltips were not displaying correctly.
So, I submitted an issue then asked on askdrupal where Pierre.Vriens advised me to apply patch #4. I tried to but since I was running 7.x-2.x-dev(2015-Feb-13) I got:
Reversed (or previously applied) patch detected! Assume -R? [n]
Raw options worked for me without applying anything.
Comment #11
drunken monkeyAs written, the patch for Highcharts (#4) was already committed, #9 just implements it for Google Charts, too.
But thanks for verifying that it at least works for Highcharts, good to know!
Comment #12
elshae CreditAttribution: elshae commentedI have an issue open at Drupal Answers, but I am currently at a stand-still. I am trying to put my Google Chart API code into a node and have the tooltips have links to other nodes. I applied the Google #raw_options patch and it was successful, but I still have no idea how to declare the #raw_options for HTML tooltips. I've added the following code to a custom module as well as suggested by Majed.Bahar on their Drupal Answers post:
And still have no luck... How can I use #raw_options to have a link in my tooltips?
Comment #13
amaria CreditAttribution: amaria commented@elshae, if you are building the chart yourself, use chart_data_item instead of raw options, and then try the patch at https://www.drupal.org/node/2876131
Comment #14
clemens.tolboomAs #4 is already applied we only need a Google Charts review of #9
In #12 @elshae applied it
So I mark this as RTBC.
Comment #16
andileco CreditAttribution: andileco at JSI Research & Training Institute, Inc. (JSI) commentedComment #17
andileco CreditAttribution: andileco at JSI Research & Training Institute, Inc. (JSI) commented