Hi
I'm hoping to get help with something that is probably easy to achieve ...
I would like to replicate an Excel style 100% Stacked Bar chart as per the attached example but just can't figure out what to do.
I've experimented with a 2D StackedBarChart but with the tabular data being used I get a separate row on the y axis for each range. Effectively I want a single row on the y axis consisting of the different range values in series.
Ideally I'd also like to use specific colours for range values so that '0 - 39 (Critical)' is red, '95 - 100 (Very Good)' is green and so on. Perhaps that should be a separate quesion to be asked after I get the basic chart layout working.
Any tips to point me in the right direction would be very much appreciated.
Adrian
Thanks for your help Max and Hristo, much appreciated.
I'm really pleased with the way this is shaping up thanks to your input.
As a final refinement I am looking at displaying both the count and percentage for each data item (see attached jpeg). For example, "60 (6%)", "80 (8%)", "140 (14%)" etc.
To achieve this I'm thinking of holding the percentage as well as the count in the data table and then hooking up to the ChartDrawItem event using the e.Primitive.Row/Column to get underlying table values which I can format as required. I guess I'd look for a Text primitive where the row and column are both not -1. Not sure if I would also need to look for a specific Path value.
Does that sound reasonable or would you recommend a better approach?
Thanks
Hello ,
I had been following Max’s suggestion in order to create a sample. Please run the sample and let me know if this is what you are looking for.
Please let me know if you have any further questions.
Yes, setting various format string properties to "<DATA_VALUE_ITEM>" instead of "<DATA_VALUE>" will give you the non-cumulative value.ultraChart1.Tooltips.FormatString = "<DATA_VALUE_ITEM>"
Great stuff, thanks very much Max.
One other question. Data values displayed on the chart and in tooltips are cumulative and not the raw value for a specific row, i.e. 60 is shown for Critical, 140 is shown for Very Poor, 270 for Poor and so on.
Is there an easy way to display the actual values (60, 80, 130 ...) instead?
Many thanks
Try using SwapRowsAndColumns property to get a single stack of values. For the brushes, you can set up a color array and use it as a color model.DataTable dt = new DataTable();dt.Columns.Add("label", typeof(string));dt.Columns.Add("Condition Scores", typeof(int));dt.Rows.Add("0 - 39 (Critical)", 60);dt.Rows.Add("40 - 64 (Very Poor)", 80);dt.Rows.Add("65 - 79 (Poor)", 130);dt.Rows.Add("80 - 89 (Fair)", 300);dt.Rows.Add("90 - 94 (Good)", 290);dt.Rows.Add("95 - 100 (Very Good)", 140);
ultraChart1.ChartType = ChartType.StackBarChart;ultraChart1.Data.DataSource = dt;ultraChart1.Data.SwapRowsAndColumns = true;
ultraChart1.ColorModel.CustomPalette = new Color[] { Color.Blue, Color.Red, Color.Yellow, Color.Turquoise, Color.Magenta, Color.Salmon };
ultraChart1.ColorModel.ModelStyle = ColorModels.CustomLinear;