Java Doc for Dataset.java in  » Chart » Chart2D_1.9.6k » net » sourceforge » chart2d » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Chart » Chart2D_1.9.6k » net.sourceforge.chart2d 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   net.sourceforge.chart2d.Dataset

Dataset
final public class Dataset (Code)
The container for the data values to chart. A dataset is like a third order array (ex. float[][][]). The first order is the "sets" order. A set contains data divided by category. The "sets" refer to the objects described by the legend labels, if a legend exists. The second order is the "cats" or categories order. Data within a set can be divided by category. A category can have multiple data items. If using a graph chart, the categories are described by the labels-axis labels. For pie charts, there is only one category. The third order is the "items" order. The "items" order are the values for a particular category and set.
For example, if we had data for the years 1999 and 2000 of how many units were sold on each day during that time, then one way to chart this would be using a graph chart and making the years correspond to the "sets" order, "months", correspond to the "cats" order, and the number of units sold per day correspond to the "items" order.
There are two important rules to mention about this. For each set, the number of cats must be the same. For each cat, the number of items must be the same. In our example, we would probably want to choose the number of items per category to be 30, corresponding the average number of days per month. For months with less than thirty days, we would populate the unfilled days with the average of the filled days or simply carry the last value of the filled days into the unfilled days. For months with more than thirty days, we would average the last two days, and use that value as the value of the last day.
If passing to a PieChart2DProperties, the value used for each pie sector is the sum of the values in each set of data. Pass this to any number of PieChart2D or GraphChart2D objects.



Constructor Summary
public  Dataset()
     Creates a dataset with 0 sets, 0 categories, and 0 items.
public  Dataset(int sets, int cats, int items)
     Creates a dataset with the specified number of sets, categories per set, and items per set and per category.
public  Dataset(Dataset dataset)
     Creates a dataset that is a copy of another dataset.

Method Summary
final public  voidadd(int set, int cat, int item, float value)
     Adds a value to the dataset increasing its internal data structure if necessary.
final  voidaddChart2D(Chart2D chart2D)
     Adds a Chart2D to the set of objects using these properties.
final public  voidaddMovingAverage(Dataset dataset, int scope)
     Analyzes the (input) dataset and adds moving average trend data to this dataset. Moving averages are computed by taking some odd number of adjacent items, computing their average and doing that from left to right for each item.
final public  voiddoConvertToStacked()
     Converts the dataset for use in "stacked" charts.
final public  voiddoShiftLower(float[] values)
     Shifts all the data items one place, from the higher order to the lower order, replacing the highest order items with the specified items.
final public  floatget(int set, int cat, int item)
     Gets the value for the variable in the set specified by set, the category specified by cat within the set, and the item specified by item within the category.
final public  floatgetAverage(int set, int cat, int item)
     Gets the average of some set of numbers.
final  booleangetChart2DNeedsUpdate(Chart2D chart2D)
     Gets whether this object needs to be updated with new properties.
Parameters:
  chart2D - The object that may need to be updated.
final public  floatgetGreatest()
     Gets the greatest value of all the data in the datset.
final public  floatgetLeast()
     Gets the least value of all the data in the datset.
final public  intgetNumCats()
     Gets the number of categories per set of data in this dataset.
final public  intgetNumItems()
     Gets the number of items per category of data in this dataset.
final public  intgetNumSets()
     Gets the number of sets of data in this dataset.
final  float[][]getOldGraphStruct()
     Gets a float[][] representation of this dataset for use by GraphChartArea.
final  float[]getOldPieStruct()
     Gets a float[] representation of this dataset for use by PieChartArea.
final public  voidremove(int set, int cat, int item)
     Removes values from the dataset.
final  voidremoveChart2D(Chart2D chart2D)
     Removes a Chart2D from the set of objects using these properties.
final public  voidset(int set, int cat, int item, float value)
     Sets the value for the variable in the set specified by set, the category specified by cat within the set, and the item specified by item within the category.
final public  voidset(Dataset dataset)
     Sets all the values of this dataset from another Dataset.
final public  voidsetDatasetToDefaults()
     Sets the dataset to its default state.
final public  voidsetMovingAverage(int set, Dataset dataset, int scope)
     Analyzes the (input) dataset and sets moving average trend data to this dataset. Moving averages are computed by taking some odd number of adjacent items, computing their average and doing that from left to right for each item.
final public  voidsetSize(int sets, int cats, int items)
     Resets the size of the dataset.
final  voidupdateChart2D(Chart2D chart2D)
     Updates the properties of this Chart2D.
final  booleanvalidate(boolean debug)
     Validates the properties of this object. If debug is true then prints a messages indicating whether each property is valid. Returns true if all the properties were valid and false otherwise.
Parameters:
  debug - If true then will print status messages.


Constructor Detail
Dataset
public Dataset()(Code)
Creates a dataset with 0 sets, 0 categories, and 0 items. Use the add (int, int, int, float) method to add data items.



Dataset
public Dataset(int sets, int cats, int items)(Code)
Creates a dataset with the specified number of sets, categories per set, and items per set and per category. All internal objects are created at once. Use the set (int, int, int, float) method to add data items.
Parameters:
  sets - The number of sets.
Parameters:
  cats - The number of categories per set.
Parameters:
  items - The number of items per category and per set.



Dataset
public Dataset(Dataset dataset)(Code)
Creates a dataset that is a copy of another dataset. Copying is a deep copy.
Parameters:
  dataset - The dataset to copy.




Method Detail
add
final public void add(int set, int cat, int item, float value)(Code)
Adds a value to the dataset increasing its internal data structure if necessary.
Parameters:
  set - The specified set of the variable.
Parameters:
  cat - The specified cat of the variable.
Parameters:
  item - The specified item of the variable.
Parameters:
  value - The specified value of the variable.



addChart2D
final void addChart2D(Chart2D chart2D)(Code)
Adds a Chart2D to the set of objects using these properties.
Parameters:
  chart2D - The object to add.



addMovingAverage
final public void addMovingAverage(Dataset dataset, int scope)(Code)
Analyzes the (input) dataset and adds moving average trend data to this dataset. Moving averages are computed by taking some odd number of adjacent items, computing their average and doing that from left to right for each item. How many adjacent items are used in computing the moving average is specified in the scope parameter.
Parameters:
  dataset - The dataset to analyze.
Parameters:
  scope - The number of data points to compute over.



doConvertToStacked
final public void doConvertToStacked()(Code)
Converts the dataset for use in "stacked" charts. This is a convenience method. Stacked charts are those where each set of data is to be stacked on top of the previous set. So if you have multiple sets of data and you want the graph components corresponding to each set to be stacked on top of the previous set but you don't want to have to adjust your data yourself to get this ***affect*** then use this method. Multiple calls to this method will change your dataset each time. You will only want to call it once. Unless you repopulate your whole dataset with virgin (i.e. never before stacked) values again.



doShiftLower
final public void doShiftLower(float[] values)(Code)
Shifts all the data items one place, from the higher order to the lower order, replacing the highest order items with the specified items. This method is designed to be used with graph charts where the data is dynamically updated and graphed over time categories. For example, if you picture a normal line chart with say three sets of data, that charts the amount of memory being used by various programs on your computer and is updated every second. The number of lines would correspond to the number of programs being charted. The number of x axis labels would refer to the number of seconds of data is being charted (ex 10 seconds). Every second, we could call shiftLower and this would shift left all the old data in the chart, and shift in to the right of the chart, some new data. There would have to be a new data value for each line in the chart. The the number of lines corresponds to the number of programs, and the number of programs, corresponds to the number of legend labels, etc, the number of data values shifted in must be equal to the number of sets in the dataset.
Parameters:
  values - An array of values of length getNumSets() to shift in.



get
final public float get(int set, int cat, int item)(Code)
Gets the value for the variable in the set specified by set, the category specified by cat within the set, and the item specified by item within the category. If internal resources have not yet been allocated to contain such a variable a null pointer error may occurr.
Parameters:
  set - The specified set of the variable.
Parameters:
  cat - The specified cat of the variable.
Parameters:
  item - The specified item of the variable. float The value of this variable.



getAverage
final public float getAverage(int set, int cat, int item)(Code)
Gets the average of some set of numbers. There are three possibilities. If you want the average of all data items in a particular set and cat, then pass -1 for item. If you want the average of all data items in a particular set and item, then pass -1 for cat. If you want the average of all data items in a particular cat and item, then pass -1 for set. Note, only one -1 may be passed in over all three parameters.
Parameters:
  set - Which particular set or -1 for all.
Parameters:
  cat - Which particular cat or -1 for all.
Parameters:
  item - Which particular item or -1 for all.



getChart2DNeedsUpdate
final boolean getChart2DNeedsUpdate(Chart2D chart2D)(Code)
Gets whether this object needs to be updated with new properties.
Parameters:
  chart2D - The object that may need to be updated. If true then needs update.



getGreatest
final public float getGreatest()(Code)
Gets the greatest value of all the data in the datset. If the dataset is invalid or empty, then returns Float.MIN_VALUE; float The greatest value in the dataset.



getLeast
final public float getLeast()(Code)
Gets the least value of all the data in the datset. If the dataset is invalid or empty, then returns Float.MAX_VALUE; float The least value in the dataset.



getNumCats
final public int getNumCats()(Code)
Gets the number of categories per set of data in this dataset. This method requires that the dataset be valid according to the method validate(). If not, then a null pointer error may occurr. int The number of cats per set of this dataset.



getNumItems
final public int getNumItems()(Code)
Gets the number of items per category of data in this dataset. This method requires that the dataset be valid according to the method validate(). If not, then a null pointer error may occurr. int The number of items per category of this dataset.



getNumSets
final public int getNumSets()(Code)
Gets the number of sets of data in this dataset. int The number of sets of this dataset.



getOldGraphStruct
final float[][] getOldGraphStruct()(Code)
Gets a float[][] representation of this dataset for use by GraphChartArea. float[][] A representation of this dataset.



getOldPieStruct
final float[] getOldPieStruct()(Code)
Gets a float[] representation of this dataset for use by PieChartArea. float[] A representation of this dataset.



remove
final public void remove(int set, int cat, int item)(Code)
Removes values from the dataset. Depending on the values of the paramters, eight different operations may result. The simplest is to remove a particular item from a particular set and a particular category. But one can also perform more complex operations. For example, one can remove every set of data. The key to modifying the behavior is passing in a negative one or -1 value for a parameter. A -1 value specifies that whatever is to be removed, will be removed for all such things (ie sets, cats, or items) corresponding to that parameter. So if one wanted to remove every set of data, one could pass -1 to set, to cat, and to item. This would be specify to remove all items, for all cats, for all sets. If one wanted to remove only a single item from a particular set and a particular category, then one would pass a non -1 value for each of the parameters. Below is a listing of the options and a short description. The letters "a", "b", "c" indicates a non -1 value.
set= -1, cat= -1, item= -1 Removes every set of data.
set= a, cat= -1, item= -1 Removes a particular set of data.
set= -1, cat= a, item= -1 Removes a particular category of data for every set.
set= a, cat= b, item= -1 Removes a particular category of data for a particular set.
set= -1, cat= -1, item= a Removes a particular item for every set and every category.
set= -1, cat= a, item= b Removes a particular item of a particular category in every set.
set= a, cat= -1, item= b Removes a particular item of a particular set in every category.
set= a, cat= b, item= c Removes a particular item of a particular category of a particular set.

Parameters:
  set - The set of data within which data is to be removed.
Parameters:
  cat - The cat of data within which data is to be removed.
Parameters:
  item - The item of data that is to be removed.



removeChart2D
final void removeChart2D(Chart2D chart2D)(Code)
Removes a Chart2D from the set of objects using these properties.
Parameters:
  chart2D - The object to remove.



set
final public void set(int set, int cat, int item, float value)(Code)
Sets the value for the variable in the set specified by set, the category specified by cat within the set, and the item specified by item within the category. If internal resources have not yet been allocated for this item, a null pointer will occurr.
Parameters:
  set - The specified set of the variable.
Parameters:
  cat - The specified cat of the variable.
Parameters:
  item - The specified item of the variable.
Parameters:
  value - The specified value of the variable.



set
final public void set(Dataset dataset)(Code)
Sets all the values of this dataset from another Dataset. The values are copied using a deep copy.
Parameters:
  dataset - The Dataset to copy.



setDatasetToDefaults
final public void setDatasetToDefaults()(Code)
Sets the dataset to its default state. It's default state is a dataset with no sets, no cats, and no items.



setMovingAverage
final public void setMovingAverage(int set, Dataset dataset, int scope)(Code)
Analyzes the (input) dataset and sets moving average trend data to this dataset. Moving averages are computed by taking some odd number of adjacent items, computing their average and doing that from left to right for each item. How many adjacent items are used in computing the moving average is specified in the scope parameter. Assumes this dataset already has the same number of cats and items, and that the set exists.
Parameters:
  set - The set into this dataset to put the moving average.
Parameters:
  dataset - The dataset to analyze.
Parameters:
  scope - The number of data points to compute over.



setSize
final public void setSize(int sets, int cats, int items)(Code)
Resets the size of the dataset. Similar to the constructor Dataset (sets, cats, items). If current size is smaller, then fills with zeroes.
Parameters:
  sets - The number of sets.
Parameters:
  cats - The number of categories per set.
Parameters:
  items - The number of items per category and per set.



updateChart2D
final void updateChart2D(Chart2D chart2D)(Code)
Updates the properties of this Chart2D.
Parameters:
  chart2D - The object to update.



validate
final boolean validate(boolean debug)(Code)
Validates the properties of this object. If debug is true then prints a messages indicating whether each property is valid. Returns true if all the properties were valid and false otherwise.
Parameters:
  debug - If true then will print status messages. If true then valid.



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.