Chart FX for Java 6.5

SoftwareFX.ChartFX
Class XMLDataProvider

java.lang.Object
  extended by SoftwareFX.ChartFX.XMLDataProvider
All Implemented Interfaces:
IDataProvider

public final class XMLDataProvider
extends java.lang.Object
implements IDataProvider

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
 java.util.Locale getCulture()
          Gets the Culture.
 java.lang.String getDateFormat()
          Gets the DateFormat.
 boolean isRowValueTag()
          Gets the RowValueTag.
 void load(java.io.InputStream stream)
          Specifies the path to the XML file.
 void load(java.lang.String filename)
          Specifies the path to the XML file.
 void loadXML(java.lang.String xmlString)
          Used to pass the XML as a string.
 void setCulture(java.util.Locale locale)
          Allows you to localize data for a specific language and region.
 void setDateFormat(java.lang.String dateFormat)
          Allows you to customize the default date format for the Chart FX XmlDataProvider.
 void setRowValueTag(boolean rowValueTag)
          Gets or sets a value indicating if the xml will include a value tag in rows.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLDataProvider

public XMLDataProvider()
Method Detail

getCulture

public java.util.Locale getCulture()

Gets the Culture. For more detail see setCulture(java.util.Locale).


getDateFormat

public java.lang.String getDateFormat()

Gets the DateFormat. For more detail see setDateFormat(java.lang.String).


isRowValueTag

public boolean isRowValueTag()

Gets the RowValueTag. For more detail see setRowValueTag(boolean).


load

public void load(java.lang.String filename)

Specifies the path to the XML file.

Remarks:
  • 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"/>

  • Parameters:
    filename -
    See Also:
    setCulture(java.util.Locale), setDateFormat(java.lang.String), loadXML(java.lang.String)

    load

    public void load(java.io.InputStream stream)

    Specifies the path to the XML file.

    Remarks:
  • 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"/>

  • Parameters:
    stream - Stream as System.IO
    See Also:
    setCulture(java.util.Locale), setDateFormat(java.lang.String), loadXML(java.lang.String)

    loadXML

    public void loadXML(java.lang.String xmlString)

    Used to pass the XML as a string.

    Remarks:
  • 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"/>

  • Parameters:
    xmlString -
    See Also:
    setCulture(java.util.Locale), setDateFormat(java.lang.String), load(java.lang.String)

    setCulture

    public void setCulture(java.util.Locale locale)

    Allows you to localize data for a specific language and region.

    Remarks:
  • Culture attributes set with this property will effect only selected data, to set localization attributes for the entire chart, please use the ChartCore.setCulture(java.lang.String) property of the Chart class.

  • If no attributes are set using this property or the Chart class ChartCore.setCulture(java.lang.String) property, then Chart FX inherits the system culture.

  • When setting this property, you may need the Languaje 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");

  • See Also:
    ChartCore.setCulture(java.lang.String), ValueFormat.setCulture(java.lang.String), Chart, ValueFormat

    setDateFormat

    public void setDateFormat(java.lang.String dateFormat)

    Allows you to customize the default date format for the Chart FX XmlDataProvider.

    Remarks:
  • 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.

  • See Also:
    TextProvider.setDateFormat(java.lang.String), TextProvider

    setRowValueTag

    public void setRowValueTag(boolean rowValueTag)

    Gets or sets a value indicating if the xml will include a value tag in rows.

    Remarks:
  • Set this property to True if your XML file includes the Value tag in each row of data.

  • See Also:
    setDateFormat(java.lang.String), setCulture(java.util.Locale), load(java.lang.String), loadXML(java.lang.String)

    http://www.softwarefx.com

    2007 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.