com.googlecode.charts4j
Class RadarChart

java.lang.Object
  extended by com.googlecode.charts4j.RadarChart
All Implemented Interfaces:
GChart, GraphChart, GridChart, TitledChart

public final class RadarChart
extends Object
implements GChart, GraphChart, TitledChart, GridChart

Radar chart constructed with the GCharts static factory class.

Author:
Julien Chastang (julien.c.chastang at gmail dot com)
See Also:
RadarPlot, GCharts

Nested Class Summary
 
Nested classes/interfaces inherited from interface com.googlecode.charts4j.TitledChart
TitledChart.ChartTitle
 
Method Summary
 void addConcentricAxisLabels(AxisLabels axisLabels)
          Add "bull's eye" labels to radar plot.
 void addConcentricAxisRangeMarker(double startPoint, double endPoint, Color color)
          Add a concentric axis range marker.
 void addRadialAxisLabels(RadialAxisLabels radialAxisLabels)
          Add "spoke" labels to radar plot.
 void addRadialAxisRangeMarker(double startPoint, double endPoint, Color color)
          Add a radial axis range marker.
 Map<String,String> getParameters()
          Get a map of all the parameters necessary to generate a Google Chart API request.
 void setAreaFill(Fill fill)
          Specify chart area fill.
 void setBackgroundFill(Fill fill)
          Specify background fill.
 void setDataEncoding(DataEncoding dataEncoding)
          Set the data encoding scheme.
 void setGrid(double xAxisStepSize, double yAxisStepSize, int lengthOfLineSegment, int lengthOfBlankSegment)
          Define a grid for this chart.
 void setLegendMargins(int legendWidth, int legendHeight)
          Specify the legend margins.
 void setLegendPosition(LegendPosition legendPosition)
          Specify where the chart legends will appear.
 void setMargins(int leftMargin, int rightMargin, int topMargin, int bottomMargin)
          Specify the chart margins.
 void setSize(int x, int y)
          Set the chart size.
 void setSpline(boolean isSpline)
          If true, points are connected with splines.
 void setTitle(String title)
          Specify a chart title.
 void setTitle(String title, Color color, int fontSize)
          Specify a chart title with color and font size.
 void setTransparency(int opacity)
          Specify the chart transparency.
 void setURLEndpoint(String urlEndpoint)
          Sets the chart URL endpoint.
 String toURLForHTML()
          Create a URL with the ampersand character entity reference (&amp;) in place of an ampersand.
 String toURLString()
          Create a URL string given the information supplied to this chart.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getParameters

public final Map<String,String> getParameters()
Get a map of all the parameters necessary to generate a Google Chart API request. This method is specifically (and perhaps only) useful in a POST request scenario. It is still up to the developers to take these parameters and generate a POST request. For instance, they may want to use JSON to pass parameters to the browser in order to make the POST request.

Specified by:
getParameters in interface GChart
Returns:
a map of all the parameters
See Also:
POST Requests

toURLForHTML

public String toURLForHTML()
Create a URL with the ampersand character entity reference (&amp;) in place of an ampersand. Useful for embedding your link in a web page.

Specified by:
toURLForHTML in interface GChart
Returns:
URL string

toURLString

public String toURLString()
Create a URL string given the information supplied to this chart. You can copy and paste this string into your web browser, and see if you get the results you anticipated. Better yet, incorporate this method call or GChart.toURLForHTML() into your Internet application to dynamically generate charts. URLs beyond 2000 characters are not recommended. You can sometimes get away with the simple encoding scheme if URL length is a problem. See GChart.setDataEncoding(DataEncoding dataEncoding)

Specified by:
toURLString in interface GChart
Returns:
URL String
See Also:
DataEncoding, WWW FAQs: What is the maximum length of a URL?

setAreaFill

public void setAreaFill(Fill fill)
Specify chart area fill.

Specified by:
setAreaFill in interface GraphChart
Parameters:
fill - Chart area fill. Cannot be null. This mutable parameter is defensively copied upon entry.

setBackgroundFill

public void setBackgroundFill(Fill fill)
Specify background fill.

Specified by:
setBackgroundFill in interface GChart
Parameters:
fill - Background fill. Cannot be null.
See Also:
Fill

setTransparency

public void setTransparency(int opacity)
Specify the chart transparency. Use cautiously as this feature may obscure background fills. Also there appears to be a bug in the Google Chart API where setting a transparency makes the label color disappear.

Specified by:
setTransparency in interface GChart
Parameters:
opacity - Supply a number between 0 and 100. 0 is completely transparent, and 100 is completely opaque.

setSize

public void setSize(int x,
                    int y)
Set the chart size. If no size is specified, the chart will default to 200x125.

Specified by:
setSize in interface GChart
Parameters:
x - chart width. Must be > 0 and <= 1000.
y - chart height. Must be > 0 and <= 1000.
See Also:
Chart Size

setTitle

public void setTitle(String title)
Specify a chart title. Use a pipe character (|) to force a line break.

Specified by:
setTitle in interface TitledChart
Parameters:
title - Chart title. Cannot be null.

setTitle

public void setTitle(String title,
                     Color color,
                     int fontSize)
Specify a chart title with color and font size. Use a pipe character (|) to force a line break.

Specified by:
setTitle in interface TitledChart
Parameters:
title - Chart title. Cannot be null.
color - Chart title color. Cannot be null.
fontSize - Chart title font size. Must be > 0.

setLegendPosition

public void setLegendPosition(LegendPosition legendPosition)
Specify where the chart legends will appear.

Specified by:
setLegendPosition in interface GraphChart
Parameters:
legendPosition - The legend position. Cannot be null.

addRadialAxisLabels

public void addRadialAxisLabels(RadialAxisLabels radialAxisLabels)
Add "spoke" labels to radar plot.

Parameters:
radialAxisLabels - Axis label information containing "spoke" labels.
See Also:
AxisLabelsFactory

addConcentricAxisLabels

public void addConcentricAxisLabels(AxisLabels axisLabels)
Add "bull's eye" labels to radar plot.

Parameters:
axisLabels - Axis label information containing "bull's eye" labels.
See Also:
AxisLabels

setSpline

public void setSpline(boolean isSpline)
If true, points are connected with splines.

Parameters:
isSpline - Are the points connected by splines.

setGrid

public void setGrid(double xAxisStepSize,
                    double yAxisStepSize,
                    int lengthOfLineSegment,
                    int lengthOfBlankSegment)
Define a grid for this chart.

Specified by:
setGrid in interface GridChart
Parameters:
xAxisStepSize - x step size. must be > 0.
yAxisStepSize - y step size. must be > 0.
lengthOfLineSegment - length of line segment. must be >= 0.
lengthOfBlankSegment - length of blank segment. must be >= 0.

addRadialAxisRangeMarker

public final void addRadialAxisRangeMarker(double startPoint,
                                           double endPoint,
                                           Color color)
Add a radial axis range marker.

Parameters:
startPoint - the 0 position is at 12 o'clock, 50 is 6 o'clock, and 100 is at 12 o'clock.
endPoint - the 0 position is at 12 o'clock, 50 is 6 o'clock, and 100 is at 12 o'clock.
color - color of range marker. Cannot be null.

addConcentricAxisRangeMarker

public final void addConcentricAxisRangeMarker(double startPoint,
                                               double endPoint,
                                               Color color)
Add a concentric axis range marker.

Parameters:
startPoint - the 0 position is at the center of the radar chart and 100 is at the outside limit.
endPoint - the 0 position is at the center of the radar chart and 100 is at the outside limit.
color - color of range marker. Cannot be null.

setDataEncoding

public void setDataEncoding(DataEncoding dataEncoding)
Set the data encoding scheme. The only advantage to the simple encoding scheme is it will ultimately result in shorter URLs, but at the cost of lower resolution. charts4j defaults to the extended encoding, but if you have lots of data and if you are willing to sacrifice resolution, the simple encoding may be right for you.

Specified by:
setDataEncoding in interface GChart
Parameters:
dataEncoding - Supply the data encoding, either simple or extended. Cannot be null.

setMargins

public void setMargins(int leftMargin,
                       int rightMargin,
                       int topMargin,
                       int bottomMargin)
Specify the chart margins. The overall size of the chart defined with the GChart.setSize(int, int) method will not change. The margin moves inward. It is similar to a CSS padding.

Specified by:
setMargins in interface GChart
Parameters:
leftMargin - the left margin
rightMargin - the right margin
topMargin - the top margin
bottomMargin - the bottom margin

setLegendMargins

public void setLegendMargins(int legendWidth,
                             int legendHeight)
Specify the legend margins.

Specified by:
setLegendMargins in interface GraphChart
Parameters:
legendWidth - the legend width
legendHeight - the legend height

setURLEndpoint

public void setURLEndpoint(String urlEndpoint)
Sets the chart URL endpoint. The default end point chart URL is http://chart.apis.google.com/chart. This method is useful in situations where other Internet services support the Google Chart API. For instance, JFreeChart has a Google Chart API emulation called Eastwood. API users can supply the Eastwood servlet address as the end point URL (e.g. http://localhost:8080/eastwood-1.1.0/chart). Note that Eastwood is not a 100% emulation of the Google Chart API so "your mileage may vary" in terms of what charts are supported by Eastwood.

Specified by:
setURLEndpoint in interface GChart
Parameters:
urlEndpoint - the new chart url endpoint
See Also:
JFreeChart Eastwood Servlet


Copyright © 2008-2011. All Rights Reserved.