|
Chart FX 7 for Java Server | |||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.softwarefx.chartfx.server.dataproviders.XmlDataProvider
public class XmlDataProvider
Provides access to the Chart's XML Data Provider object.
XML has proven to be a very dynamic and flexible means of data storage. Chart FX has been developed with this in mind and includes an XmlDataProvider. Using the XmlDataProvider, you can pass XML data directly to your charts for display.
When passing the data using the XML data provider, the data is passed as columns and rows, the same as with a table. The following rules apply:
a) There must be a special tag indicating that the information enclosed is the column's definition. By default this tag is named <COLUMNS>. Each column will need a separate COLUMN tag. The format is:
<COLUMNS>
<COLUMN NAME="Column1_Name" TYPE="Column1_Type" DESCRIPTION="Column1_Desciption" />
<COLUMN NAME="ColumnN_Name" TYPE="ColumnN_Type" DESCRIPTION="ColumnN_Desciption" />
</COLUMNS>
The Description attribute is optional. If it is included, it will be used as a Series or Value legend. If it is not present, the configured Column Name will be assigned as a Series or Value legend instead.
b) As you can see above, each column name is configured with a type. The attribute Type is case sensitive, and the supported data types are String, Integer, Double, Short, Float, Boolean, Byte and Date.
c) Every row is then defined using the following format:
<ROW Column1_Name="Value" ... ColumnN_Name="Value"/>
Constructor Summary | |
---|---|
XmlDataProvider()
|
Method Summary | |
---|---|
XmlColumnCollection |
getColumns()
Returns the collection of XmlColumns. |
Locale |
getCulture()
Gets the Culture. |
String |
getDateFormat()
Gets the DateFormat. |
boolean |
isRowsAsElements()
Gets the RowsAsElements. |
void |
load(InputStream stream)
Specifies the path to the XML file. |
void |
load(String filename)
Specifies the path to the XML file. |
void |
loadXML(String xmlString)
Used to pass the XML as a string. |
void |
setCulture(Locale locale)
Allows you to localize data for a specific language and region. |
void |
setDateFormat(String dateFormat)
Allows you to customize the default date format for the Chart FX XmlDataProvider. |
void |
setRowsAsElements(boolean RowsAsElements)
Sets the bool value that determines row data format. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public XmlDataProvider()
Method Detail |
---|
public XmlColumnCollection getColumns()
Returns the collection of XmlColumns.
This collection is empty until XmlColumns are added.
public Locale getCulture()
Gets the Culture. For more detail see setCulture(java.util.Locale)
.
public String getDateFormat()
Gets the DateFormat. For more detail see setDateFormat(java.lang.String)
.
public boolean isRowsAsElements()
Gets the RowsAsElements. For more detail see setRowsAsElements(boolean)
.
public void load(InputStream stream)
Specifies the path to the XML file.
You can pass the xml data parameter as either a string or stream using this method.
When passing the data using the XML data provider, the data is passed as columns and rows, the same as with a table. The following rules apply:
a) There must be a special tag indicating that the information enclosed is the column's definition. By default this tag is named <COLUMNS>. Each column will need a separate COLUMN tag. The format is:
<COLUMNS>
<COLUMN NAME="Column1_Name" TYPE="Column1_Type" DESCRIPTION="Column1_Desciption" />
<COLUMN NAME="ColumnN_Name" TYPE="ColumnN_Type" DESCRIPTION="ColumnN_Desciption" />
</COLUMNS>
The Description attribute is optional. If it is included, it will be used as a Series or Value legend. If it is not present, the configured Column Name will be assigned as a Series or Value legend instead.
b) As you can see above, each column name is configured with a type. The attribute Type is case sensitive, and the supported data types are String, Integer, Double, Short, Float, Boolean, Byte and Date.
c) Every row is then defined using the following format:
<ROW Column1_Name="Value" ... ColumnN_Name="Value"/>
stream
- Stream as System.IOsetCulture(java.util.Locale)
,
setDateFormat(java.lang.String)
,
loadXML(java.lang.String)
public void load(String filename)
Specifies the path to the XML file.
You can pass the xml data parameter as either a string or stream using this method.
When passing the data using the XML data provider, the data is passed as columns and rows, the same as with a table. The following rules apply:
a) There must be a special tag indicating that the information enclosed is the column's definition. By default this tag is named <COLUMNS>. Each column will need a separate COLUMN tag. The format is:
<COLUMNS>
<COLUMN NAME="Column1_Name" TYPE="Column1_Type" DESCRIPTION="Column1_Desciption" />
<COLUMN NAME="ColumnN_Name" TYPE="ColumnN_Type" DESCRIPTION="ColumnN_Desciption" />
</COLUMNS>
The Description attribute is optional. If it is included, it will be used as a Series or Value legend. If it is not present, the configured Column Name will be assigned as a Series or Value legend instead.
b) As you can see above, each column name is configured with a type. The attribute Type is case sensitive, and the supported data types are String, Integer, Double, Short, Float, Boolean, Byte and Date.
c) Every row is then defined using the following format:
<ROW Column1_Name="Value" ... ColumnN_Name="Value"/>
filename
- setCulture(java.util.Locale)
,
setDateFormat(java.lang.String)
,
loadXML(java.lang.String)
public void loadXML(String xmlString)
Used to pass the XML as a string.
This method allows you to concatenate the contents of an xml file into one string and pass that string as the XML data.
When passing the data using the XML data provider, the data is passed as columns and rows, the same as with a table. The following rules apply:
a) There must be a special tag indicating that the information enclosed is the column's definition. By default this tag is named <COLUMNS>. Each column will need a separate COLUMN tag. The format is:
<COLUMNS>
<COLUMN NAME="Column1_Name" TYPE="Column1_Type" DESCRIPTION="Column1_Desciption" />
<COLUMN NAME="ColumnN_Name" TYPE="ColumnN_Type" DESCRIPTION="ColumnN_Desciption" />
</COLUMNS>
The Description attribute is optional. If it is included, it will be used as a Series or Value legend. If it is not present, the configured Column Name will be assigned as a Series or Value legend instead.
b) As you can see above, each column name is configured with a type. The attribute Type is case sensitive, and the supported data types are String, Integer, Double, Short, Float, Boolean, Byte and Date.
c) Every row is then defined using the following format:
<ROW Column1_Name="Value" ... ColumnN_Name="Value"/>
xmlString
- setCulture(java.util.Locale)
,
setDateFormat(java.lang.String)
,
load(java.io.InputStream)
public void setCulture(Locale locale)
Allows you to localize data for a specific language and region.
Culture attributes set with this property will effect only selected data, to set localization attributes for the entire chart, please use the Chart.setCulture(java.util.Locale)
property of the Chart
Class
.
If no attributes are set using this property or the Chart
Class
Chart.setCulture(java.util.Locale)
property, then Chart FX inherits the system culture.
When setting this property, you may need the Language Code and/or Country Code constants for the desired culture. For more information, please refer to the java.util.Locale documentation.
Example:
XmlDataProvider xmldp = new XmlDataProvider("myxmlfile.xml");
xmldp.setCulture("es-ES");
Chart.setCulture(java.util.Locale)
,
ValueFormat.setCulture(java.util.Locale)
,
Chart
,
ValueFormat
public void setDateFormat(String dateFormat)
Allows you to customize the default date format for the Chart FX XmlDataProvider.
When dates are included in the XML file and are in a format other than "mm/dd/yyyy" (which is the default format), the DateFormat property must be used to create a mask that will instruct Chart FX how to understand the values.
TextProvider.setDateFormat(java.lang.String)
,
TextProvider
public void setRowsAsElements(boolean RowsAsElements)
Sets the bool value that determines row data format.
This property allows you to specify the format of row data. Either as nodes(elements) or attributes. The default settings is attribute (false).
|
http://www.softwarefx.com | |||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |