2D Size & Background API

Canvas

Set Size
Set Background Color
Set Background Image
Image Modes
Set Table Visible
Chart Plot Area
Set Size
Set Position
Set Gridlines Visible
Border Raised, Lowered, or Shadowed
Background Color
Background Control Area
Border Visible/Border Color
Canvas
To manually specify these properties, first create an ICanvas object that has a handle on the chart's Canvas.  Then, Canvas properties can be edited through methods in the ICanvas class.
 
// create an ICanvas object, “hCanvas”, that
// has a handle on the chart’s Canvas
ICanvas hCanvas = chart.gethCanvas();
Set Size  
// set canvas size (width, height) in pixels
Dimension canvasDimension = new Dimension(500, 400);
hCanvas.setSize(canvasDimension);
 
Set Background Color  
// set background color to white
hCanvas.setBackgroundColor(Color.white);
 
Set Background Image  
// set background image to "turn.gif”
URL url = new URL( "http://archon/espresschart31/backgroundImages/turn.gif");
hCanvas.setBackgroundImageURL(url);
 
Image Modes  
// set image in “TILE” mode
hCanvas.setImageMode(QbChart.TILE);
 
Set Table Visible
Note: this is not supported in bubble, scatter and surface charts. For information on Set Table Visible, please refer to Table API.
Chart Plot Area
First create an IPlot object that has a handle on the chart's plot.  Then, the properties can be specified through methods in IPlot.
// create an IPlot object, “hChartPlot”, that
// has a handle on the chart's plot
IPlot hChartPlot = chart.gethChartPlot();
Set Size  
// set the chart plot/graph size relative to the canvas size
hChartPlot.setRelativeHeight( (float)0.6 );
hChartPlot.setRelativeWidth( (float)0.7 );
 
Set Position  
// set the relative position of the plot
hChartPlot.setPosition( new Position( (float)0.2, (float)0.15 ) );  
Set Gridlines Visible  
// set the vertical gridlines visible, and to blue color
chart.gethXAxis().setGridVisible(true);
chart.gethXAxis().setGridColor( Color.blue);

// set the horizontal gridlines visible, and to blue color
chart.gethYAxis().setGridVisible(true);
chart.gethYAxis().setGridColor( Color.blue);
 

Border Raised, Lowered, or Shadowed  
// set chart plot area's background properties
hChartPlot.setAppearance(QbChartBasic.RAISE);
hChartPlot.setDepth( 5 );    //in pixels

Background Color  
hChartPlot.setBackgroundVisible(true);
hChartPlot.setBackgroundColor( Color.gray);
 
Background Control Area  
// set control ranges for the chart plot area
// ControlRange(double startScale, double endScale, java.awt.Color color,
//     java.lang.String title, boolean showInLegend)
// control range from 0 to 24, labeled safe, but not shown in legend box
ControlRange ctrl = new ControlRange( 0.0, 24.0, Color.cyan, “safe”, false);
 
Border Visible/Border Color  
// set chart plot area’s border properties
hChartPlot.setBorderColor( Color.red );
hChartPlot.setBorderThickness(5); //in pixels
hChartPlot.setBorderVisible( true );
Please refer to QbChart, ICanvas, IMiscConstants, & IPlot in EspressChart APIDocs for additional information.