Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.java4less.rchart
Class GaugePlotter

    java.lang.Object
      |
      +--com.java4less.rchart.ChartComponent
            |
            +--com.java4less.rchart.Plotter
                  |
                  +--com.java4less.rchart.GaugePlotter

public class GaugePlotter
extends Plotter

    Plotter used to create a gauge chart. It only accepts DataSeries of type GaugeDataSerie.

    Example of Gauge chart:

    // data
    double[] d1={44,30};
    // style of the pie
    FillStyle[] s1={new FillStyle(GraphicsProvider.getColor(ChartColor.BLACK)),new FillStyle(GraphicsProvider.getColor(ChartColor.CYAN)),new FillStyle(GraphicsProvider.getColor(ChartColor.GREEN)),new FillStyle(GraphicsProvider.getColor(ChartColor.YELLOW))};
    GaugeDataSerie data1= new GaugeDataSerie(d1,s1);
    data1.valueFont=GraphicsProvider.getFont("Arial",ChartFont.PLAIN,14);

    // legend
    Legend l=new Legend();
    l.background=new FillStyle(GraphicsProvider.getColor(ChartColor.LIGHTGRAY));
    l.border=new LineStyle(0.2f,GraphicsProvider.getColor(ChartColor.BLACK),LineStyle.LINE_NORMAL);
    l.addItem("Needle 1",new FillStyle(GraphicsProvider.getColor(ChartColor.BLACK)));
    l.addItem("Needle 2",new FillStyle(GraphicsProvider.getColor(ChartColor.CYAN)));

    // create title
    Title title=new Title("Sales 1999");

    // plotter
    GaugePlotter plot=new GaugePlotter();

    Scale s=new Scale();
    s.min=0;
    s.max=50;
    Axis a=new Axis(Axis.HORIZONTAL,s);
    a.scaleTickInterval=5;
    a.bigTickInterval=1;
    a.startWithBigTick=true;
    a.IntegerScale=true;
    a.DescFont=GraphicsProvider.getFont("Serif",ChartFont.BOLD,12);
    plot.axis1=a;

    Scale s2=new Scale();
    s2.min=0;
    s2.max=100;
    Axis a2=new Axis(Axis.HORIZONTAL,s2);
    a2.style=new LineStyle(2f,GraphicsProvider.getColor(ChartColor.WHITE),LineStyle.LINE_NORMAL);
    a2.scaleTickInterval=2;
    a2.bigTickInterval=5;
    a2.startWithBigTick=true;
    a2.IntegerScale=true;
    a2.DescColor=GraphicsProvider.getColor(ChartColor.WHITE);

    plot.axis1LabelMargin=-25;
    plot.axis2=a2;
    plot.maxZone=40;
    plot.minZone=10;
    plot.startAngle=-20;
    plot.endAngle=200;

    GaugePlotter subplot=new GaugePlotter();
    Scale ssub=new Scale();
    ssub.min=0;
    ssub.max=100;
    Axis asub=new Axis(Axis.HORIZONTAL,ssub);
    asub.IntegerScale=true;
    asub.DescFont=GraphicsProvider.getFont("Serif",ChartFont.PLAIN,8);
    asub.scaleTickInterval=5;
    asub.bigTickInterval=5;
    asub.startWithBigTick=true;
    subplot.axis1=asub;
    subplot.gaugeback=new FillStyle(GraphicsProvider.getColor(ChartColor.WHITE));
    subplot.endAngle=-50;
    subplot.startAngle=230;
    subplot.axis1LabelMargin=-20;
    plot.subGauge2=subplot;

    // create chart
    Chart chart=new Chart(title,plot,null,null);
    // add legend
    chart.legend=l;
    // add data
    chart.addSerie(data1);

Field Summary
`Axis` | `axis1` primary scale (external)
`int` | `axis1LabelMargin` axisLabel margin, distance between ticks and label.
`int` | `axis1Margin` pixels between border and ticks
`Axis` | `axis2` secondary scale (internal)
`int` | `axis2LabelMargin` axisLabel margin, distance between ticks and label.
`int` | `axis2Margin` pixels between border and ticks
`LineStyle` | `border` style of the border
`int` | `endAngle` end angle of the gauge (default is 200).
`FillStyle` | `gaugeback` Gauge background
`int` | `maxminZoneMargin` start position of the ring for the max min zone.
`int` | `maxminZoneWidth` width in pixels of the ring for the max and min zones
`double` | `maxZone` maxColor will be used to paint the ticks higher than maxZone.
`FillStyle` | `maxZoneColor` color of the ticks of the scale near to the maximum value
`double` | `minZone` minColor will be used to paint the ticks lower than minZone.
`FillStyle` | `minZoneColor` color of the ticks of the scale near to the minimum value
`int` | `needleBase` size of the circle painted as needle base (default is 8 which means 8% of the radius)
`double` | `radiusModifier` modifies the size of the gauge.
`int` | `startAngle` start angle of the gauge (default is -20).
`GaugePlotter` | `subGauge1` subgauge 1
`GaugePlotter` | `subGauge2` subgauge 2
`int` | `subGaugeSize` Subgauge size .

Fields inherited from class com.java4less.rchart.Plotter
`back, backImage, depth, visibleHeight, visibleWidth, XScale, Y2Scale, YScale`

Fields inherited from class com.java4less.rchart.ChartComponent
`height, width, x, y`

Constructor Summary
`GaugePlotter()` constructor

Methods inherited from class com.java4less.rchart.Plotter
`addSerie, getCombinable, getNeedsAxis, getSerie, getSeriesCount, plot, plotBackground, replaceSerie, setSerie`

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### needleBase

    public int needleBase

  size of the circle painted as needle base (default is 8 which means 8% of the radius)

### radiusModifier

    public double radiusModifier

  modifies the size of the gauge. The default value is 1. A value of 0.5 will create a circle half the size of the default.

### border

    public LineStyle border

  style of the border

### axis1LabelMargin

    public int axis1LabelMargin

  axisLabel margin, distance between ticks and label. Use positive/negative to place the labels outside/inside the circle.

### axis2LabelMargin

    public int axis2LabelMargin

  axisLabel margin, distance between ticks and label. Use positive/negative to place the labels outside/inside the circle.

### axis2Margin

    public int axis2Margin

  pixels between border and ticks

### axis1Margin

    public int axis1Margin

  pixels between border and ticks

### axis1

    public Axis axis1

  primary scale (external)

### axis2

    public Axis axis2

  secondary scale (internal)

### maxZoneColor

    public FillStyle maxZoneColor

  color of the ticks of the scale near to the maximum value

### maxminZoneWidth

    public int maxminZoneWidth

  width in pixels of the ring for the max and min zones

### maxminZoneMargin

    public int maxminZoneMargin

  start position of the ring for the max min zone. This is the distence from the border

### maxZone

    public double maxZone

  maxColor will be used to paint the ticks higher than maxZone.

### minZoneColor

    public FillStyle minZoneColor

  color of the ticks of the scale near to the minimum value

### minZone

    public double minZone

  minColor will be used to paint the ticks lower than minZone.

### startAngle

    public int startAngle

  start angle of the gauge (default is -20).

### endAngle

    public int endAngle

  end angle of the gauge (default is 200).

### gaugeback

    public FillStyle gaugeback

  Gauge background

### subGauge1

    public GaugePlotter subGauge1

  subgauge 1

### subGauge2

    public GaugePlotter subGauge2

  subgauge 2

### subGaugeSize

    public int subGaugeSize

  Subgauge size . % of the main gauge. Default is 30

Constructor Detail

### GaugePlotter

    public GaugePlotter()

  constructor

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD