J4L-CHART for Ruby

Copyright 2011, J4L Components (http://www.java4less.com)

Go bak to contents


Radarchart configuration

This is a complete example of a radar chart:

 
Parameters
Description
Equivalent Ruby class/property
  WIDTH=390
HEIGHT=300
TITLECHART=Costs analysis
SERIE_1=Product A
SERIE_2=Product B
SERIE_TYPE_1=RADAR
SERIE_TYPE_2=RADAR SERIE_FONT_1=Arial|PLAIN|8 SERIE_FONT_2=Arial|PLAIN|8 SERIE_DATA_1=12|73|50|95 SERIE_DATA_2=20|41|60|10 SERIE_STYLE_1=0.2|BLUE|LINE SERIE_STYLE_2=0.2|GREEN|LINE SERIE_FILL_1=BLUE
SERIE_POINT_1=true
SERIE_POINT_2=true SERIE_POINT_COLOR_1=BLUE SERIE_POINT_COLOR_2=GREEN RADARCHART_BACK=WHITE RADARCHART_BORDER=0.2|BLACK|LINE RADARCHART_FACTOR_COLOR=BLACK RADARCHART_FACTOR_FONT=Arial|PLAIN|12 RADARCHART_FACTOR_MAX=100|100|100|100 RADARCHART_FACTOR_MIN=0|0|0|0 RADARCHART_FACTOR_NAMES=R & D|Distribution|Marketing|other RADARCHART_GRID=0.2|GRAY|DASHED RADARCHART_GRID_FONT=Arial|PLAIN|8 RADARCHART_GRID_FONT_COLOR=GRAY RADARCHART_RADIUS=0.8 CHART_BORDER=0.2|#000000|NORMAL CHART_FILL=#ccffcc

Size
Size
Title

Name of series
Name of series
Radarchart type
Radarchart type
Fonts
Fonts
Values to plot (series 1).

Values to plot (series 2).
Style of lines
Style of lines
Serie 1 should be filled (blue area)
Draw points
Draw points
Color of points
Color of points
Background of chart area
Border of radarchart
Color of fonts
Font
Max. values of the axis (factors)
Min. values of the axis (factors)
Names of the axis (factors)

Style of grid.
Font of gid labels
Color of grid labels
Size of radarchart (default is 0.9)
Chart's border
Chart's background

radarPlotter= J4LChart::RadarPlotter.new()

 

serie1= J4LChart::LineDataSerie.new(values,lstyle)
serie2= J4LChart::LineDataSerie.new(values,lstyle)

serie1.valueFont= J4LChart::GraphicsProvider.getfont(...)

 

 

serie1.fillStyle= J4LChart::FillStyle.new(  J4LChart::GraphicsProvider.getcolor( J4LChart::BLUE))
serie1.drawPoint=true

serie1.pointColor= J4LChart::GraphicsProvider.getcolor( J4LChart::BLUE)

radarPlotter.backStyle= J4LChart::FillStyle.new(...)
radarPlotter.border= J4LChart::LineStyle.new(...)
radarPlotter.factorColor = J4LChart::GraphicsProvider.getcolor( J4LChart::BLACK)
radarPlotter.factorFont= J4LChart::GraphicsProvider.getfont(...)
radarPlotter.factorMaxs=[100,100,100,100]
radarPlotter.factorMins=[0,0,0,0]
radarPlotter.factorNames=["R & D", ....]

radarPlotter.gridStyle= J4LChart::LineStyle.new(...)
radarPlotter.gridFont= J4LChart::GraphicsProvider.getfont(...)
radarPlotter.gridFontColor= J4LChart::GraphicsProvider.getcolor( J4LChart::GRAY)
radarPlotter.radiusModifier=0.8

 

It is also possible to have more than 4 factors (axis). In the following example we have a new axis called "NEW" whose scale is different from the others, 0 to 200.

 
Parameters
Description
Equivalent Ruby class/property
  SERIE_DATA_1=12|73|50|95|120 SERIE_DATA_2=20|41|60|10|20 RADARCHART_FACTOR_MAX=100|100|100|100|200 RADARCHART_FACTOR_MIN=0|0|0|0|0 RADARCHART_FACTOR_NAMES=R & D|Distribution|Marketing|other|NEW

Values to plot (series 1).
Values to plot (series 2).
Max. values of the axis (factors)
Min. values of the axis (factors)
Names of factors

See above

 

It is also possible to have a circular radar chart using the following parameters:

 
Parameters
Description
Equivalent Ruby class/property
 

RADARCHART_CIRCLE=TRUE
RADARCHART_TICKS=4 RADARCHART_FACTOR_COLOR=#ff0000 RADARCHART_FACTOR_FONT=Dialog|ITALIC|12

Circular chart
Number of lines in grid
(defualt is 5)
Color of factors' names is RED
Font os factors' names

radarPlotter.drawCircle=true
radarPlotter.ticks=4

 

You can use different colors for each factor name using the following parameter:

 
Parameters
Description
Equivalent Ruby class/property
 

RADARCHART_FACTOR_COLORS=RED|BLUE|GREEN|GRAY|BLACK

List of colors

radarPlotter.factorColors

 

The following 2 parameters allows you to change the color of the points, depending on the value:

 

Example:

 
Parameters
Description
Equivalent Ruby class/property
 

RADARCHART_POINT_COLORS_SCALE=20|40|60|80 RADARCHART_POINT_COLORS=#ffff00|#ffc800|#ff0000|#cc3333|#000000

Scale
Colors

radarPlotter.pointColorsScale
radarPlotter.pointColors

values under 20 will have a yellow point, values between 20 and 40 will have an orange color, values beetwen 40 and 60 will have a red color, values beetwen 60 and 80 will have a dark red color and values above 80 will have a black point.