public final class GridLine extends Line
Provides access to the GridLine object.
GridLines are used to place lines across the Axes, at the major and minor intervals.
Major GridLines will show the lines at the setStep
. Minor Gridlines will show line at the setMinorStepDateTime
.
PopulateProductSales(chart1);
chart1.getTitles().add(new TitleDockable("Monthly Wines Sales by Type"));
chart1.getAxisY().getLabelsFormat().setFormat(AxisFormat.CURRENCY);
chart1.getAxisY().getGrids().getMajor().setVisible(true);
chart1.getAxisY().getGrids().getMajor().setWidth((short)2);
chart1.getAxisY().getGrids().getMinor().setVisible(true);
chart1.getAxisY().getGrids().getMinor().setStyle(DashStyle.DOT);
java.util.EnumSet<AxisStyles> style = chart1.getAxisY().getStyle();
style.add(AxisStyles.AUTO_MINOR_STEP);
chart1.getAxisY().setStyle(style);
public static void PopulateProductSales(Chart chart1) { ProductSales[] data = new ProductSales[]{ new ProductSales("Jan", 12560, 23400, 34500), new ProductSales("Feb", 13400, 21000, 38900), new ProductSales("Mar", 16700, 17000, 42100), new ProductSales("Apr", 12000, 19020, 43800), new ProductSales("May", 15800, 26500, 37540), new ProductSales("Jun", 9800, 27800, 32580), new ProductSales("Jul", 17800, 29820, 34000), new ProductSales("Aug", 19800, 17800, 38000), new ProductSales("Sep", 23200, 32000, 41300), new ProductSales("Oct", 16700, 26500, 46590), new ProductSales("Nov", 11800, 23000, 48700), new ProductSales("Dec", 13400, 15400, 49100) }; ObjectProvider objProvider = new ObjectProvider(data); chart1.getDataSourceSettings().setDataSource(objProvider); }
public static class ProductSales { public ProductSales(String month, double white, double red, double sparkling) { this.setMonth(month); this.setWhite(white); this.setRed(red); this.setSparkling(sparkling); } private String privateMonth; public final String getMonth() { return privateMonth; } public final void setMonth(String value) { privateMonth = value; } private double privateWhite; public final double getWhite() { return privateWhite; } public final void setWhite(double value) { privateWhite = value; } private double privateRed; public final double getRed() { return privateRed; } public final void setRed(double value) { privateRed = value; } private double privateSparkling; public final double getSparkling() { return privateSparkling; } public final void setSparkling(double value) { privateSparkling = value; } }
Constructor and Description |
---|
GridLine()
Constructs a newly allocated GridLine object
|
Modifier and Type | Method and Description |
---|---|
TickMark |
getTickMark()
Gets or sets the style for the tick marks of an GridLine object.
|
boolean |
isVisible()
Gets or sets a value indicating whether the grid line for the selected Gridline will be visible.
|
void |
resetTickMark()
Set the property TickMark to its default value.
|
void |
resetVisible()
Set the property Visible to its default value.
|
void |
setTickMark(TickMark value)
Gets or sets the style for the tick marks of an GridLine object.
|
void |
setVisible(boolean value)
Gets or sets a value indicating whether the grid line for the selected Gridline will be visible.
|
getColor, getEndCap, getStartCap, getStyle, getWidth, resetColor, resetEndCap, resetSeriesIndex, resetStartCap, resetStyle, resetWidth, setColor, setEndCap, setStartCap, setStyle, setWidth
public TickMark getTickMark()
Gets or sets the style for the tick marks of an GridLine object.
The tick mark is not the gridline that crosses the entire chart, it is just a reference line that appears on every tick of the minor unit of the axis. If you want to display a gridline that crosses the chart, please refer to the Grids
method.
The major unit is controlled by the setStep
method, the minor unit is controlled by the setMinorStepDateTime
method.
To configure the TickMark style as Cross for the Major step in the Y Axis:
chart1.getAxisY().getGrids().getMajor().setTickMark(TickMark.CROSS);
PopulateProductSales(chart1);
chart1.getTitles().add(new TitleDockable("Wine Sales by Type"));
chart1.getAxisY().getLabelsFormat().setFormat(AxisFormat.CURRENCY);
public static void PopulateProductSales(Chart chart1) { ProductSales[] data = new ProductSales[]{ new ProductSales("Jan", 12560, 23400, 34500), new ProductSales("Feb", 13400, 21000, 38900), new ProductSales("Mar", 16700, 17000, 42100), new ProductSales("Apr", 12000, 19020, 43800), new ProductSales("May", 15800, 26500, 37540), new ProductSales("Jun", 9800, 27800, 32580), new ProductSales("Jul", 17800, 29820, 34000), new ProductSales("Aug", 19800, 17800, 38000), new ProductSales("Sep", 23200, 32000, 41300), new ProductSales("Oct", 16700, 26500, 46590), new ProductSales("Nov", 11800, 23000, 48700), new ProductSales("Dec", 13400, 15400, 49100) }; ObjectProvider objProvider = new ObjectProvider(data); chart1.getDataSourceSettings().setDataSource(objProvider); }
public static class ProductSales { public ProductSales(String month, double white, double red, double sparkling) { this.setMonth(month); this.setWhite(white); this.setRed(red); this.setSparkling(sparkling); } private String privateMonth; public final String getMonth() { return privateMonth; } public final void setMonth(String value) { privateMonth = value; } private double privateWhite; public final double getWhite() { return privateWhite; } public final void setWhite(double value) { privateWhite = value; } private double privateRed; public final double getRed() { return privateRed; } public final void setRed(double value) { privateRed = value; } private double privateSparkling; public final double getSparkling() { return privateSparkling; } public final void setSparkling(double value) { privateSparkling = value; } }
resetTickMark
public void setTickMark(TickMark value)
Gets or sets the style for the tick marks of an GridLine object.
The tick mark is not the gridline that crosses the entire chart, it is just a reference line that appears on every tick of the minor unit of the axis. If you want to display a gridline that crosses the chart, please refer to the Grids
method.
The major unit is controlled by the setStep
method, the minor unit is controlled by the setMinorStepDateTime
method.
To configure the TickMark style as Cross for the Major step in the Y Axis:
chart1.getAxisY().getGrids().getMajor().setTickMark(TickMark.CROSS);
PopulateProductSales(chart1);
chart1.getTitles().add(new TitleDockable("Wine Sales by Type"));
chart1.getAxisY().getLabelsFormat().setFormat(AxisFormat.CURRENCY);
public static void PopulateProductSales(Chart chart1) { ProductSales[] data = new ProductSales[]{ new ProductSales("Jan", 12560, 23400, 34500), new ProductSales("Feb", 13400, 21000, 38900), new ProductSales("Mar", 16700, 17000, 42100), new ProductSales("Apr", 12000, 19020, 43800), new ProductSales("May", 15800, 26500, 37540), new ProductSales("Jun", 9800, 27800, 32580), new ProductSales("Jul", 17800, 29820, 34000), new ProductSales("Aug", 19800, 17800, 38000), new ProductSales("Sep", 23200, 32000, 41300), new ProductSales("Oct", 16700, 26500, 46590), new ProductSales("Nov", 11800, 23000, 48700), new ProductSales("Dec", 13400, 15400, 49100) }; ObjectProvider objProvider = new ObjectProvider(data); chart1.getDataSourceSettings().setDataSource(objProvider); }
public static class ProductSales { public ProductSales(String month, double white, double red, double sparkling) { this.setMonth(month); this.setWhite(white); this.setRed(red); this.setSparkling(sparkling); } private String privateMonth; public final String getMonth() { return privateMonth; } public final void setMonth(String value) { privateMonth = value; } private double privateWhite; public final double getWhite() { return privateWhite; } public final void setWhite(double value) { privateWhite = value; } private double privateRed; public final double getRed() { return privateRed; } public final void setRed(double value) { privateRed = value; } private double privateSparkling; public final double getSparkling() { return privateSparkling; } public final void setSparkling(double value) { privateSparkling = value; } }
value
- resetTickMark
public boolean isVisible()
Gets or sets a value indicating whether the grid line for the selected Gridline will be visible.
By default, this method is set to true. You will need to configure the grid line's isVisible
method to True in order to see the object in the chart.
To turn on the Minor gridlines for the Y Axis:
chart1.getAxisY().setMinorStep(5); chart1.getAxisY().getGrids().getMinor().setVisible(true);
resetVisible
public void setVisible(boolean value)
Gets or sets a value indicating whether the grid line for the selected Gridline will be visible.
By default, this method is set to true. You will need to configure the grid line's isVisible
method to True in order to see the object in the chart.
To turn on the Minor gridlines for the Y Axis:
chart1.getAxisY().setMinorStep(5); chart1.getAxisY().getGrids().getMinor().setVisible(true);
value
- resetVisible
public void resetTickMark()
setTickMark
public void resetVisible()
isVisible
2014 Software FX, Inc. All Rights Reserved. Chart FX is a registered trademark of Software FX, Inc
All other names are trademarks or registered trademarks of their respective owners.