J4L-CHART for Ruby

Copyright 2011, J4L Components (http://www.java4less.com)
Go bak to contents


Miscelaneous

 

 

Combined charts (Lines and bars)

You can easily combine lines and charts by creating 2 series, where one of the serie is a line serie and the other a bars serie:

Parameters
Description
Equivalent Ruby class/property

SERIE_1=Products
SERIE_2=Services
SERIE_TYPE_1=BAR
SERIE_TYPE_2=LINE
SERIE_DATA_1=30|30|34|23|40
SERIE_DATA_2=83|70|95|70|52
SERIE_DATAX_2=1|2|3|4|5|6|7

Definition of the scale

First serie, bars (in the background)
Second serie, line (in the foreground)
Bars values
Line values
Make the like start at tick 1 to that it is aligned with the bars

linePlotter= J4LChart::LinePlotter.new()
barPlotter= J4LChart::BarPlotter.new()





serie1= J4LChart::BarDataSerie.new(fillStyle,values1)
serie2= J4LChart::LineDataSerie.new(lineStyle,values2)

chart= J4LChart::Chart.new()
chart.resetChart(cTitle,barPlotter,cXAxis,cYAxis)
chart.addPlotter(linePlot)