Hi all,
I want to create Stacked Bar Chart using jfreechart. I have following type of data:
DID (Unqiue Id)
SID (Unqiue Id-In each SID, there are lot of unique DIDs)
Height (Integer number which determines the height of each DID)
CID (Contains list of common DID across SID. So, there is a need to assign common color patterns for DID across SID)
So, in short, this stackedbarchart will provide a view of common "DID"s across "SID".
The issue that I am facing is how can I tell the system to use unique color patterns for the list of common DID across SID.
Please guide me. I will be thankful to you.
Issue in assigning unique colors for each common segment
-
- Posts: 3
- Joined: Thu May 04, 2017 9:40 pm
- antibot: No, of course not.
-
- Posts: 513
- Joined: Wed Sep 12, 2007 3:18 pm
Re: Issue in assigning unique colors for each common segment
I don't understand the pattern you want to achieve, but this example override's the renderer's getItemPaint() method to print out the row, column and default color for each item. You can examine the dataset entry corresponding to each row and column to decide what color to return.
-
- Posts: 3
- Joined: Thu May 04, 2017 9:40 pm
- antibot: No, of course not.
Re: Issue in assigning unique colors for each common segment
Hi John,
Thanks for your reply. I am a novice user in using Jfreecharts, that's why I am struggling in creating stack bar chart of desired values.
I am attaching "Table values" and demo of "Stack bar chart".
I am assigning values like
Here, I cannot be able to use the variable "Height", which I would like.
In the attached image of "Stack bar chart", I have mentioned what desired result would I like by using annotations.
Please assist me how can I use all the combinations of four values (SID, DID, CID, Height) in creating a desired stack bar chart?
It will be really great, if you can post some sample code of that. I will be extremely thankful to you.
https://drive.google.com/file/d/0B2YaKt ... sp=sharing
https://drive.google.com/file/d/0B2YaKt ... sp=sharing
Thanks for your reply. I am a novice user in using Jfreecharts, that's why I am struggling in creating stack bar chart of desired values.
I am attaching "Table values" and demo of "Stack bar chart".
I am assigning values like
Code: Select all
dataset.addValue(DID, CID,SID);
In the attached image of "Stack bar chart", I have mentioned what desired result would I like by using annotations.
Please assist me how can I use all the combinations of four values (SID, DID, CID, Height) in creating a desired stack bar chart?
It will be really great, if you can post some sample code of that. I will be extremely thankful to you.
https://drive.google.com/file/d/0B2YaKt ... sp=sharing
https://drive.google.com/file/d/0B2YaKt ... sp=sharing
-
- Posts: 513
- Joined: Wed Sep 12, 2007 3:18 pm
-
- Posts: 3
- Joined: Thu May 04, 2017 9:40 pm
- antibot: No, of course not.
Re: Issue in assigning unique colors for each common segment
Thanks John for your reply, I have successfully resolved the issue.