|
JClass DesktopViews 6.3.0 API Documentation |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.klg.jclass.chart.data.JCDataInterpreter | +--com.klg.jclass.chart.data.JCXMLDataInterpreter
Implements a interpreter for the chart XML data format. Relies on input
from some reader to populate the specified BaseDataSource
class.
Data can be loaded either by series or by point.
data-point-label
and data-series-label
tags are
optional with either method. To represent virtual hole values in an
x-data
or y-data
tag, use the word
HOLE
.
Here is an example of an XML data file loading by series.
This can be used to represent both the array and general style
data sources that are used by the default chart data source.
If only one data-series
tag contains x-data
tags,
that x data will be used for every series. Otherwise, each series uses its
own x-data
tags to define its x data.
<?xml version="1.0"?> <!DOCTYPE chart-data SYSTEM "chart-data.dtd"> <chart-data name="My Chart" hole="MAX"> <data-point-label> Point Label 1 </data-point-label> <data-point-label> Point Label 2 </data-point-label> <data-point-label> Point Label 3 </data-point-label> <data-point-label> Point Label 4 </data-point-label> <data-series> <data-series-label> Y Axis #1 Data </data-series-label> <x-data>1</x-data> <x-data>2</x-data> <x-data>3</x-data> <x-data>4</x-data> <y-data>1</y-data> <y-data>2</y-data> <y-data>3</y-data> <y-data>4</y-data> </data-series> <data-series> <data-series-label> Y Axis #2 Data </data-series-label> <y-data>1</y-data> <y-data>4</y-data> <y-data>9</y-data> <y-data>16</y-data> </data-series> </chart-data>Here is an example of an XML data file loading by point. This format is similar to the transposed array format of the default chart data source. No more than one
x-data
tag can be
used per data-point
tag. If no x-data
tags are
present at all, x data will be generated automatically staring at 1 in
increments of 1. If some data-point
tags contain an
x-data
tags and others do not, the missing pieces of x data
will be filled with the hole value.
<?xml version="1.0"?> <!DOCTYPE chart-data SYSTEM "chart-data.dtd"> <chart-data name="MyChart"> <data-series-label> Y Data </data-series-label> <data-series-label> Y 2 Data </data-series-label> <data-point> <data-point-label> Point Label 1 </data-point-label> <x-data>1</x-data> <y-data>1</y-data> <y-data>1</y-data> </data-point> <data-point> <data-point-label> Point Label 2 </data-point-label> <x-data>2</x-data> <y-data>2</y-data> <y-data>4</y-data> </data-point> <data-point> <data-point-label> Point Label 3 </data-point-label> <x-data>3</x-data> <y-data>3</y-data> <y-data>9</y-data> </data-point> <data-point> <data-point-label> Point Label 4 </data-point-label> <x-data>4</x-data> <y-data>4</y-data> <y-data>16</y-data> </data-point> </chart-data>
Field Summary | |
static String |
DATA_DTD_NAME
|
protected com.klg.jclass.util.io.LoadProperties |
loadProperties
|
Fields inherited from class com.klg.jclass.chart.data.JCDataInterpreter |
baseDS |
Constructor Summary | |
JCXMLDataInterpreter()
Default no-argument constructor. |
|
JCXMLDataInterpreter(com.klg.jclass.chart.data.BaseDataSource bds)
This constructor creates an instance of a data interpreter and associates it with a data source. |
|
JCXMLDataInterpreter(com.klg.jclass.chart.data.BaseDataSource bds,
com.klg.jclass.util.io.LoadProperties lp)
This constructor creates an instance of a data interpreter and associates it with a data source. |
|
JCXMLDataInterpreter(com.klg.jclass.util.io.LoadProperties lp)
Constructor specifying LoadProperties class. |
Method Summary | |
protected void |
ctor(Reader r)
Parses the specified input stream according to the XML chart data format and populates the previously set data source. |
void |
loadData(InputSource inSource,
boolean validate)
Internal use only. |
Methods inherited from class com.klg.jclass.chart.data.JCDataInterpreter |
setBaseDataSource |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static String DATA_DTD_NAME
protected com.klg.jclass.util.io.LoadProperties loadProperties
Constructor Detail |
public JCXMLDataInterpreter()
public JCXMLDataInterpreter(com.klg.jclass.util.io.LoadProperties lp)
public JCXMLDataInterpreter(com.klg.jclass.chart.data.BaseDataSource bds) throws IOException
bds
- the data source to eventually populate with the interpreted data
IOException
public JCXMLDataInterpreter(com.klg.jclass.chart.data.BaseDataSource bds, com.klg.jclass.util.io.LoadProperties lp) throws IOException
bds
- the data source to eventually populate with the interpreted datalp
- an instance of LoadProperties which contains attributes
related to XML parsing of files.
IOException
Method Detail |
protected void ctor(Reader r) throws IOException
ctor()
method, and also used for String
input where you cannot have an input stream.
ctor
in class JCDataInterpreter
r
- the Reader
object used to read data
IOException
public void loadData(InputSource inSource, boolean validate) throws IOException, JCParseException
We are not sure if synchronized is really necessary, but would hate for someone to be in the middle of init still when they decide they want to start drawing the chart.
inSource
- the InputSource
that contains the data filevalidate
- true
if validation should be turned on
IOException
JCParseException
|
Copyright © 2004 Quest Software Inc.. All rights reserved. |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |