Hello All ,
I want to display Vertical Bar Chart for 5 integer Values .I am using DefalutCatagoryDataset ,all constructors includes 2 dimenstional array [][] but there is no possibility that i can define dataset wiht single dimentional array say any arry of Integer []=new Integer[]{"2","3","4","6","10"};
I am surprised wiht this as I've Purchased docs for $30 but they cant help me to achieve above. So eventualy i have two options either to implement myo own Datastructures or to convert my Integer[] to Integer[][] .
I hope you all understood well what i wana say .
Regards
Awais Bajwa
No Construcotor Integer[] for BarChart
Re: No Construcotor Integer[] for BarChart
Hi Awais,
It's difficult to provide constructors that suit everyone. Two-dimensional arrays of double primitives or Number objects are supported. But by all means write your own dataset implementation to wrap whatever data structure you are using...the DefaultCategoryDataset is just one possible implementation.
Converting a single dimensional array into a two-dimensional array is no problem, the following code works just fine:
double[] data = new double[] { 1.0, 2.0, 3.0, 4.0, 5.0 };
DefaultCategoryDataset dataset = new DefaultCategoryDataset(new double[][] { data });
Regards,
DG
It's difficult to provide constructors that suit everyone. Two-dimensional arrays of double primitives or Number objects are supported. But by all means write your own dataset implementation to wrap whatever data structure you are using...the DefaultCategoryDataset is just one possible implementation.
Converting a single dimensional array into a two-dimensional array is no problem, the following code works just fine:
double[] data = new double[] { 1.0, 2.0, 3.0, 4.0, 5.0 };
DefaultCategoryDataset dataset = new DefaultCategoryDataset(new double[][] { data });
Regards,
DG
Re: No Construcotor Integer[] for BarChart
Hello David,
Thank for your reply .
I did the same thing in my case but not such simple as i had to generate Integer [][] array at RunTime .
For the time being i did what you said ,but can you tell me some easy way to implement my own dataset using DataSet Interface that data can be displayed in the BarCart .Kindly name the Interfaces which i have to implenment .
Best Regards.
Thank for your reply .
I did the same thing in my case but not such simple as i had to generate Integer [][] array at RunTime .
For the time being i did what you said ,but can you tell me some easy way to implement my own dataset using DataSet Interface that data can be displayed in the BarCart .Kindly name the Interfaces which i have to implenment .
Best Regards.
Re: No Construcotor Integer[] for BarChart
Hi Awais,
i would suggest you use
public class myOwnDataset extends AbstractSeriesDataset implements CategoryDataset
just like the DefaultCategoryDataset does. Works fine!
Regards,
Andreas Schroeder
i would suggest you use
public class myOwnDataset extends AbstractSeriesDataset implements CategoryDataset
just like the DefaultCategoryDataset does. Works fine!
Regards,
Andreas Schroeder