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.
I have been trying to understand how to create a simple line chart using this module, but have been unsuccessful in finding any information on how to do this. I would like to plot two lines on the chart corresponding to results for two users (UserA and UserB). UserA's results = 10, 20, 30 and UserB's results = 40, 50, 60. How would I construct such a chart array?
$chart = array(
'#chart_id' => 'test_chart',
'#title' => chart_title(t('Results'), 'CCCCCC', 15),
'#type' => CHART_TYPE_LINE_XY,
'#size' => chart_size(800, 300),
);
$chart['#data'][] = array(10, 20, 30);
$chart['#data'][] = array(40, 50, 60);
$chart['#mixed_axis_labels'][CHART_AXIS_Y_LEFT][0][] = chart_mixed_axis_range_label(0, 100);
return theme('chart', array('chart' => $chart));
Comments
Comment #1
voj CreditAttribution: voj commentedHI Begun,
There an example codes of the module here:
https://code.google.com/p/drupal-chart-api/wiki/Examples
I think there should be a link on the projects page to give them the heads up.
Comment #2
Pierre.Vriens CreditAttribution: Pierre.Vriens commentedAbout #1: there is a link (actually 2 ...) on the project page these days (probably not 2 years ago), however that link point to https://code.google.com/p/drupal-chart-api/w/overview (instead of .../samples). If you use the "wiki" tab on the linked page, you get a directory listing, which corresponds to URL https://code.google.com/p/drupal-chart-api/w/list .
It appears to me that we should at least COPY that info to some D.O community doc, so that when you use a D.O search, there is a possibility that chart related search results show up in it (for sure not anything from https://code.google.com/p/drupal-chart-api/w/ - whatever). True, we'd be duplicating code (and hence maintenance effort), but that seems the price to pay I believe.
Related question: what are the (historical?) reasons why all that docu around https://code.google.com/p/drupal-chart-api/w/list ever ended up there, instead of within the D.O community docu where (at least these days) I think it should be?
For now I'm adapting the title of this issue (and some issue meta tags), hoping that anybody will add some reasons / arguments to yes or no do so. If no such feedback is added to this issue, I suggest to some day CLONE that info into the community docu. Maybe with an intermediate phase which is to create such community docu pages, but only to point to the existing google code wiki.
Comment #3
Pierre.Vriens CreditAttribution: Pierre.Vriens commentedComment #4
Pierre.Vriens CreditAttribution: Pierre.Vriens commentedAbout 1 week later no objections received. Therefor I'm updating this issue (time is running, no more time to waste ...)
Note that by copying that info, we will also have kind of backup copy in case the google wiki ever disappears ... Similar to the charting library issue related to the April 2015 deadline.
PS: feel free to contribute to this task ...