public class ImageBackground extends java.lang.Object implements IBackgroundAdornment
The ImageBackground is used to set an image for the background of a chart.
Chart FX supports rendering an image either in the setChartBackground
or in the setPlotAreaBackground
of the chart.Chart
The setMode
method is used to get or set the rendering style for the background image. Use the setImage
method to configure the picture file to be used for the ImageBackground.
Below is a chart where an image has been configured for the setChartBackground
:
ImageBackground imageBackground;
imageBackground = new ImageBackground();
imageBackground.setImage(new javax.swing.ImageIcon("CompanyLogo.png"));
imageBackground.setMode(ImageMode.CENTER);
chart1.setChartBackground(imageBackground);
PopulateNewConstructions(chart1);
chart1.getTitles().add(new TitleDockable("New Constructions in US Market"));
chart1.getAxisX().getScale().setStep(((DataUnit)SfxNET.System.TimeSpan.FromDays(30.0)));
chart1.getLegendBox().setDock(DockArea.BOTTOM);
public static void PopulateNewConstructions(Chart chart1) { NewConstructions[] data = new NewConstructions[] { new NewConstructions(new java.util.GregorianCalendar(2012, 7, 1).getTime(), 88, 116, 351, 186 ), new NewConstructions(new java.util.GregorianCalendar(2012, 8, 1).getTime(), 75, 128, 376, 170 ), new NewConstructions(new java.util.GregorianCalendar(2012, 9, 1).getTime(), 79, 147, 424, 204 ), new NewConstructions(new java.util.GregorianCalendar(2012, 10, 1).getTime(), 75, 151, 425, 213 ), new NewConstructions(new java.util.GregorianCalendar(2012, 11, 1).getTime(), 68, 154, 449, 171 ), new NewConstructions(new java.util.GregorianCalendar(2012, 12, 1).getTime(), 115, 190, 465, 213 ), new NewConstructions(new java.util.GregorianCalendar(2013, 1, 1).getTime(), 87, 95, 483, 233 ), new NewConstructions(new java.util.GregorianCalendar(2013, 2, 1).getTime(), 106, 135, 505, 223 ), new NewConstructions(new java.util.GregorianCalendar(2013, 3, 1).getTime(), 94, 140, 554, 217 ), new NewConstructions(new java.util.GregorianCalendar(2013, 4, 1).getTime(), 79, 154, 412, 207 ), new NewConstructions(new java.util.GregorianCalendar(2013, 5, 1).getTime(), 101, 135, 482, 201 ), new NewConstructions(new java.util.GregorianCalendar(2013, 6, 1).getTime(), 82, 126, 431, 207 ) }; ObjectProvider objProvider = new ObjectProvider(data); chart1.getDataSourceSettings().setDataSource(objProvider); }
public static class NewConstructions { public NewConstructions(java.util.Date date, double northeast, double midwest, double south, double west) { this.setDate(date); this.setNortheast(northeast); this.setMidwest(midwest); this.setSouth(south); this.setWest(west); } private java.util.Date privateDate = new java.util.Date(0); public final java.util.Date getDate() { return privateDate; } public final void setDate(java.util.Date value) { privateDate = value; } private double privateNortheast; public final double getNortheast() { return privateNortheast; } public final void setNortheast(double value) { privateNortheast = value; } private double privateMidwest; public final double getMidwest() { return privateMidwest; } public final void setMidwest(double value) { privateMidwest = value; } private double privateSouth; public final double getSouth() { return privateSouth; } public final void setSouth(double value) { privateSouth = value; } private double privateWest; public final double getWest() { return privateWest; } public final void setWest(double value) { privateWest = value; } }
Additional Required Files: Click to Download
Constructor and Description |
---|
ImageBackground()
Constructs a newly allocated ImageBackground object
|
ImageBackground(java.awt.Image image)
Constructs a newly allocated ImageBackground object
|
ImageBackground(java.lang.String path)
Constructs a newly allocated ImageBackground object
|
Modifier and Type | Method and Description |
---|---|
java.awt.Color |
getBackColor()
Gets or sets the background color when an ImageBackground object uses a picture with transparency.
|
java.awt.Image |
getImage()
Gets or sets a image for the ImageBackground object.
|
ImageMode |
getMode()
Gets or sets the rendering style for the image used as the ImageBackground.
|
void |
resetBackColor()
Set the property BackColor to its default value.
|
void |
resetImage()
Set the property Image to its default value.
|
void |
resetMode()
Set the property Mode to its default value.
|
void |
setBackColor(java.awt.Color value)
Gets or sets the background color when an ImageBackground object uses a picture with transparency.
|
void |
setImage(java.awt.Image value)
Gets or sets a image for the ImageBackground object.
|
void |
setMode(ImageMode value)
Gets or sets the rendering style for the image used as the ImageBackground.
|
public ImageBackground()
public ImageBackground(java.awt.Image image)
image
- public ImageBackground(java.lang.String path)
path
- public java.awt.Color getBackColor()
Gets or sets the background color when an ImageBackground object uses a picture with transparency.
For more information regarding the Color type, please refer to the Documentation.
Alternativelly, you can use the setPlotAreaColor
and setBackColor
methods of the Chart
.
Below, the BackColor is set to LightBlue:
PopulateProductSales(chart1);
chart1.getTitles().add(new TitleDockable("Wine Sales by Type"));
chart1.getAxisY().getLabelsFormat().setFormat(AxisFormat.CURRENCY);
java.awt.image.BufferedImage bitmap;
bitmap = ((java.awt.image.BufferedImage)new javax.swing.ImageIcon("SFX_logo.jpg"));
SfxNET.System.Drawing.Bitmap.MakeTransparent(bitmap, new java.awt.Color(255,255,255,255));
ImageBackground b;
b = new ImageBackground();
b.setImage(bitmap);
b.setMode(ImageMode.CENTER);
b.setBackColor(new java.awt.Color(173,216,230,255));
chart1.setChartBackground(b);
chart1.setPlotAreaColor(new java.awt.Color(0, 0, 0, 0));
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; } }
Additional Required Files: Click to Download
resetBackColor
public void setBackColor(java.awt.Color value)
Gets or sets the background color when an ImageBackground object uses a picture with transparency.
For more information regarding the Color type, please refer to the Documentation.
Alternativelly, you can use the setPlotAreaColor
and setBackColor
methods of the Chart
.
Below, the BackColor is set to LightBlue:
PopulateProductSales(chart1);
chart1.getTitles().add(new TitleDockable("Wine Sales by Type"));
chart1.getAxisY().getLabelsFormat().setFormat(AxisFormat.CURRENCY);
java.awt.image.BufferedImage bitmap;
bitmap = ((java.awt.image.BufferedImage)new javax.swing.ImageIcon("SFX_logo.jpg"));
SfxNET.System.Drawing.Bitmap.MakeTransparent(bitmap, new java.awt.Color(255,255,255,255));
ImageBackground b;
b = new ImageBackground();
b.setImage(bitmap);
b.setMode(ImageMode.CENTER);
b.setBackColor(new java.awt.Color(173,216,230,255));
chart1.setChartBackground(b);
chart1.setPlotAreaColor(new java.awt.Color(0, 0, 0, 0));
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; } }
Additional Required Files: Click to Download
value
- resetBackColor
public java.awt.Image getImage()
Gets or sets a image for the ImageBackground object.
To make the background image viewable, the setPlotAreaColor
of the Chart
has to be transparent (default).
You may need to adjust the setTextColor
and setChartFont
within the Chart
when using this method to make the chart readable.
For more information regarding the Image type, please refer to the Documentation.
An image has been set as the setChartBackground
for the chart below:
PopulateProductSales(chart1);
chart1.getTitles().add(new TitleDockable("Wine Sales by Type"));
chart1.getAxisY().getLabelsFormat().setFormat(AxisFormat.CURRENCY);
java.awt.image.BufferedImage bitmap;
bitmap = ((java.awt.image.BufferedImage)new javax.swing.ImageIcon("SFX_logo.jpg"));
SfxNET.System.Drawing.Bitmap.MakeTransparent(bitmap, new java.awt.Color(255,255,255,255));
ImageBackground b;
b = new ImageBackground();
b.setImage(bitmap);
b.setMode(ImageMode.CENTER);
b.setBackColor(new java.awt.Color(173,216,230,255));
chart1.setPlotAreaBackground(b);
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; } }
resetImage
public void setImage(java.awt.Image value)
Gets or sets a image for the ImageBackground object.
To make the background image viewable, the setPlotAreaColor
of the Chart
has to be transparent (default).
You may need to adjust the setTextColor
and setChartFont
within the Chart
when using this method to make the chart readable.
For more information regarding the Image type, please refer to the Documentation.
An image has been set as the setChartBackground
for the chart below:
PopulateProductSales(chart1);
chart1.getTitles().add(new TitleDockable("Wine Sales by Type"));
chart1.getAxisY().getLabelsFormat().setFormat(AxisFormat.CURRENCY);
java.awt.image.BufferedImage bitmap;
bitmap = ((java.awt.image.BufferedImage)new javax.swing.ImageIcon("SFX_logo.jpg"));
SfxNET.System.Drawing.Bitmap.MakeTransparent(bitmap, new java.awt.Color(255,255,255,255));
ImageBackground b;
b = new ImageBackground();
b.setImage(bitmap);
b.setMode(ImageMode.CENTER);
b.setBackColor(new java.awt.Color(173,216,230,255));
chart1.setPlotAreaBackground(b);
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
- resetImage
public ImageMode getMode()
Gets or sets the rendering style for the image used as the ImageBackground.
PopulateProductSales(chart1);
chart1.getTitles().add(new TitleDockable("Wine Sales by Type"));
chart1.getAxisY().getLabelsFormat().setFormat(AxisFormat.CURRENCY);
java.awt.image.BufferedImage bitmap;
bitmap = ((java.awt.image.BufferedImage)new javax.swing.ImageIcon("SFX_logo.jpg"));
SfxNET.System.Drawing.Bitmap.MakeTransparent(bitmap, new java.awt.Color(255,255,255,255));
ImageBackground b;
b = new ImageBackground();
b.setImage(bitmap);
b.setMode(ImageMode.WATERMARK);
b.setBackColor(new java.awt.Color(102,205,170,255));
chart1.setChartBackground(b);
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; } }
PopulateProductSales(chart1);
chart1.getTitles().add(new TitleDockable("Wine Sales by Type"));
chart1.getAxisY().getLabelsFormat().setFormat(AxisFormat.CURRENCY);
java.awt.image.BufferedImage bitmap;
bitmap = ((java.awt.image.BufferedImage)new javax.swing.ImageIcon("chartfxLogo.jpg"));
SfxNET.System.Drawing.Bitmap.MakeTransparent(bitmap, new java.awt.Color(255,255,255,255));
ImageBackground b;
b = new ImageBackground();
b.setImage(bitmap);
b.setMode(ImageMode.TILE);
b.setBackColor(new java.awt.Color(255,255,255,255));
chart1.setChartBackground(b);
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; } }
Additional Required Files: Click to Download
PopulateProductSales(chart1);
chart1.getTitles().add(new TitleDockable("Wine Sales by Type"));
chart1.getAxisY().getLabelsFormat().setFormat(AxisFormat.CURRENCY);
java.awt.image.BufferedImage bitmap;
bitmap = ((java.awt.image.BufferedImage)new javax.swing.ImageIcon("SFX_logo.jpg"));
SfxNET.System.Drawing.Bitmap.MakeTransparent(bitmap, new java.awt.Color(255,255,255,255));
ImageBackground b;
b = new ImageBackground();
b.setImage(bitmap);
b.setMode(ImageMode.CENTER);
b.setBackColor(new java.awt.Color(102,205,170,255));
chart1.setChartBackground(b);
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; } }
resetMode
public void setMode(ImageMode value)
Gets or sets the rendering style for the image used as the ImageBackground.
PopulateProductSales(chart1);
chart1.getTitles().add(new TitleDockable("Wine Sales by Type"));
chart1.getAxisY().getLabelsFormat().setFormat(AxisFormat.CURRENCY);
java.awt.image.BufferedImage bitmap;
bitmap = ((java.awt.image.BufferedImage)new javax.swing.ImageIcon("SFX_logo.jpg"));
SfxNET.System.Drawing.Bitmap.MakeTransparent(bitmap, new java.awt.Color(255,255,255,255));
ImageBackground b;
b = new ImageBackground();
b.setImage(bitmap);
b.setMode(ImageMode.WATERMARK);
b.setBackColor(new java.awt.Color(102,205,170,255));
chart1.setChartBackground(b);
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; } }
PopulateProductSales(chart1);
chart1.getTitles().add(new TitleDockable("Wine Sales by Type"));
chart1.getAxisY().getLabelsFormat().setFormat(AxisFormat.CURRENCY);
java.awt.image.BufferedImage bitmap;
bitmap = ((java.awt.image.BufferedImage)new javax.swing.ImageIcon("chartfxLogo.jpg"));
SfxNET.System.Drawing.Bitmap.MakeTransparent(bitmap, new java.awt.Color(255,255,255,255));
ImageBackground b;
b = new ImageBackground();
b.setImage(bitmap);
b.setMode(ImageMode.TILE);
b.setBackColor(new java.awt.Color(255,255,255,255));
chart1.setChartBackground(b);
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; } }
Additional Required Files: Click to Download
PopulateProductSales(chart1);
chart1.getTitles().add(new TitleDockable("Wine Sales by Type"));
chart1.getAxisY().getLabelsFormat().setFormat(AxisFormat.CURRENCY);
java.awt.image.BufferedImage bitmap;
bitmap = ((java.awt.image.BufferedImage)new javax.swing.ImageIcon("SFX_logo.jpg"));
SfxNET.System.Drawing.Bitmap.MakeTransparent(bitmap, new java.awt.Color(255,255,255,255));
ImageBackground b;
b = new ImageBackground();
b.setImage(bitmap);
b.setMode(ImageMode.CENTER);
b.setBackColor(new java.awt.Color(102,205,170,255));
chart1.setChartBackground(b);
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
- resetMode
public void resetBackColor()
setBackColor
public void resetImage()
setImage
public void resetMode()
setMode
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.