org.moxieapps.gwt.highcharts.client
Class PlotLine

java.lang.Object
  extended by org.moxieapps.gwt.highcharts.client.Configurable<PlotLine>
      extended by org.moxieapps.gwt.highcharts.client.PlotLine

public class PlotLine
extends Configurable<PlotLine>

A configurable class that can be used to represent plot lines on an axis of the chart, which can then be set on an axis (via the Axis.setPlotLines(PlotLine...) method.) Note that a plot line is a line stretching across the plot area, marking a specific value on one of the axes. Example usage:

   XAxis xAxis = chart.getXAxis();
   xAxis.setPlotLines(
     xAxis.createPlotLine()
        .setColor("#CC0000")
        .setValue(40),
     xAxis.createPlotLine()
        .setColor("#009900")
        .setValue(60)
   );
 

Since:
1.0.0
Author:
squinn@moxiegroup.com (Shawn Quinn)

Nested Class Summary
static class PlotLine.DashStyle
          An enumeration of supported dash style types, which can be passed to the setDashStyle(DashStyle) method.
 
Method Summary
 PlotLine setColor(Color color)
          Convenience method for setting the 'color' option of the plot line, allowing for colors with opacity or gradients.
 PlotLine setColor(String color)
          Convenience method for setting the 'color' option of the plot line to an RGB hex value.
 PlotLine setDashStyle(PlotLine.DashStyle dashStyle)
          Convenience method for setting the 'dashStyle' plot line optoin.
 PlotLine setLabel(PlotLineLabel plotLineLabel)
          Convenience method for setting the 'label' options of the plot line.
 PlotLine setValue(Number value)
          Convenience method for setting the 'value' option of the plot line.
 PlotLine setWidth(Number width)
          Convenience method for setting the 'width' option of the plot line.
 PlotLine setZIndex(Number zIndex)
          Convenience method for setting the 'zIndex' option of the plot line.
 
Methods inherited from class org.moxieapps.gwt.highcharts.client.Configurable
getOptions, setOption
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

setColor

public PlotLine setColor(String color)
Convenience method for setting the 'color' option of the plot line to an RGB hex value. Equivalent to:

     plotLine.setOption("color", "#CCCCCC");
 
The RGB color for the plot line. Defaults to null.

Note that this method is intended for setting the color to a simple RBG hex value. If you instead want to set a color to include an alpha channel or a gradient, use the setColor(Color) version instead.

Parameters:
color - The value to set as the 'color' option on the plot line.
Returns:
A reference to this PlotLine instance for convenient method chaining.

setColor

public PlotLine setColor(Color color)
Convenience method for setting the 'color' option of the plot line, allowing for colors with opacity or gradients. Equivalent to:

     plotLine.setOption("color", new Color()
        .setLinearGradient(0.0, 0.0, 1.0, 1.0)
        .addStop(new Color(255, 255, 255))
        .addStop(new Color(200, 200, 255))
     );
 
The color or gradient for the plot line. Defaults to null.

Note that this method is intended for setting the color to a gradient or color that includes an alpha channel. If you instead just want to set the color to a normal RGB hex value you can use the setColor(String) version instead.

Parameters:
color - The color gradient or color with an alpha channel to set as the 'color' option on the plot line.
Returns:
A reference to this PlotLine instance for convenient method chaining.

setDashStyle

public PlotLine setDashStyle(PlotLine.DashStyle dashStyle)
Convenience method for setting the 'dashStyle' plot line optoin. Equivalent to:

     plotLine.setOption("dashStyle", DashStyle.DOT);
 
The dashing or dot style for the plot line. Defaults to PlotLine.DashStyle.SOLID. See this demonstration for a visible reference of the available dash styles.

Parameters:
dashStyle - The dash style to use for this plot line, or null to use the default.
Returns:
A reference to this PlotLine instance for convenient method chaining.

setLabel

public PlotLine setLabel(PlotLineLabel plotLineLabel)
Convenience method for setting the 'label' options of the plot line. Equivalent to:

     plotLine.setOption("/label/align", PlotLineLabel.Align.LEFT);
     plotLine.setOption("/label/x", 20);
     etc....
 

Parameters:
plotLineLabel - The options for the label on the plot line.
Returns:
A reference to this PlotLine instance for convenient method chaining.

setValue

public PlotLine setValue(Number value)
Convenience method for setting the 'value' option of the plot line. Equivalent to:

     plotLine.setOption("value", 40);
 
The position of the line in axis units. Defaults to null.

Parameters:
value - The position of the line in axis units.
Returns:
A reference to this PlotLine instance for convenient method chaining.

setWidth

public PlotLine setWidth(Number width)
Convenience method for setting the 'width' option of the plot line. Equivalent to:

     plotLine.setOption("width", 2);
 
The width or thickness of the plot line. Defaults to null.

Parameters:
width - The width or thickness of the plot line.
Returns:
A reference to this PlotLine instance for convenient method chaining.

setZIndex

public PlotLine setZIndex(Number zIndex)
Convenience method for setting the 'zIndex' option of the plot line. Equivalent to:

     plotLine.setOption("zIndex", 100);
 
The z index of the plot line within the chart. Defaults to null.

Parameters:
zIndex - The z index of the plot line within the chart.
Returns:
A reference to this PlotLine instance for convenient method chaining.


Copyright © 2015. All Rights Reserved.