I needed to add a line chart overlay to an existing bar chart.
As http://code.google.com/apis/chart/image/docs/gallery/compound_charts.html states, it's only a matter of explicitly setting the data series count in the chd property and setting the line markers via chm.
Suppose you have 3 series of data and another one to overlay. You just populate the data array with the 4 series as usual, being the overlay series the last one to be populated.
When done, just set #data_series explicitly to 3 and adjust markers like this:
//Populate your 4 data series
$chartg['#data_series'] = 3;
$chartg['#shape_markers'] = array(array('D','000000',3,0,3));
//Render your chart as usual
The above #shape_markers array will draw a 2px wide black line (D) using the third data series.
It's working for me on both dev and prod sites.
I was aware of #1250720: Line Markers and Circle Markers integration for making Composite Charts through Views, but it was not working for me. Since I want to modify as little as possible the prod site and I'm afraid of using -dev code in a prod site I did it this way. I just changed my patch original property name to #data_series to match -dev when it gets stable in the future.
Comments
Comment #1
amonteroComment #2
13rac1 CreditAttribution: 13rac1 commentedNo patch is attached and patches must go against -dev. Please use the -dev code to correct any recent issues. Thanks!
Comment #3
amonteroHi eosrei.
Gotta go home now. If it's reviewed ok, I will gladly apply it to -dev.
Thanks.
Comment #4
amonteroHere's the -dev targetted patch. I'm aware that fixes and feats should go against dev, but I patched against 1.1 because it was the branch I'm currently using in the prod site. Posting here would allow reviewing and maybe help others in my situation.
Patch against 7.x-1.1 branch reposted here for clarity, it's the txt attachment.
Comment #5
amonteroComment #6
amonteroIs there anything more I can do to make this into -dev?
It is meant to be ignored if property not set. It's working for me on 2 prod and some dev sites with no problem to date. I thought in rerolling against -mk, but since I'm using the API directly without views, -dev seems fine.
TIA.
Comment #7
13rac1 CreditAttribution: 13rac1 commentedApplied to dev. Thanks!
http://drupalcode.org/project/chart.git/blobdiff/1a9b0635f90d578c72e3228...
Comment #8.0
(not verified) CreditAttribution: commentedIssue # link markup