Reputation: 935
Please see attached screeshot. i want to set label dynamically for X axis. Currently is says Test1,Test2,Test3,Test4..if i want to set a category array dynamically how can i do that? i mean i want to set category like House Expense,Office Rent, Food...etc. Here is screenshot and code.
http://www.screencast.com/t/lak24QQvfM3
Here is the bar chart code. see line between 86-90.
http://pastebin.com/MXq4zTbw
Can anyone help me with that? If anything is not clear please ask.
Thanks in advance.
Upvotes: 1
Views: 171
Reputation: 5923
Replace your createDataset()
with something like this:
private static CategoryDataset createDataset() {
DefaultCategoryDataset dataset = new DefaultCategoryDataset();
dataset.addValue(40.0,"Expediture","House");
dataset.addValue(30.0,"Expediture","Office Rent");
dataset.addValue(-20.5,"Expediture","Food");
dataset.addValue(30.0,"Expediture","Other");
dataset.addValue(6.0,"Expediture","Etc");
return dataset;
}
Upvotes: 1