While creating the barchart, i fill dataset in below way
DefaultCategoryDataset dataset = new DefaultCategoryDataset();
dataset.setValue(40, "ram", "sunday");
dataset.setValue(50, "ram", "monday");
dataset.setValue(40, "arun", "sunday");
dataset.setValue(50, "arun", "sunday");
In the last statement, the value is 50,arun,sunday and in the previous statement, the value is 40,arun,sunday .. Here in the dataset the value 50 always been considered and value 40 is always overridden.
I need to retain it still.Not sure how to do it. Is there anything i am missing ?? Please help
DefaultCategoryDatasetuses internally DefaultKeyedValues2D store the values.As said in Java doc of DefaultKeyedValues2D#setValue.
That is why your value will get updated if you use same
key. Key here refers toarun