Gradient Bar Graph.

616 views
Skip to first unread message

monloi perez

unread,
Sep 16, 2010, 8:20:27 AM9/16/10
to jqplot...@googlegroups.com
All,

How do you create a gradient colored bar graph?


Thanks,
Mon


Lluis Nieto Soler

unread,
Jul 12, 2013, 5:06:57 AM7/12/13
to jqplot...@googlegroups.com
I'm going mad trying this. I'm stuck arround the line 470 of jqplot.barRenderer.js trying to add the code to fill gradient color in polygons without success. I would appreciate any info about this issue.

Lluis Nieto Soler

unread,
Jul 12, 2013, 6:00:11 AM7/12/13
to jqplot...@googlegroups.com
Done!

After the line ~ 465 in jqplot.barRenderer.js:

this._dataColors.push(clr);

.. add the following code:

var grd = ctx.createLinearGradient(points[0][0], points[0][1], points[1][0], points[1][1]);
// dark blue
grd.addColorStop(0, '#02618D');
// light blue
grd.addColorStop(1, '#008ACA');
ctx.fillStyle = grd;
opts.fillStyle = grd;

This generates de gradient object capturing the bar coordinates and adding it to the options parameter.
Not sure if this will do any conflict. In my case works fine :)
Reply all
Reply to author
Forward
0 new messages