We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Problem making Categorical Stacked Bar Chart

I am trying to replicate a chart that I have in Excel in Windows Forms Charts. Right now I am using SyncFusion 6.3.0.6. It is a stacked-column chart with a categorical x-axis.

I have attached a picture of the chart I am trying to replicate. None of my attempts have come close, and I still do not know how to solve the x-axis problem, since it seems that x-axises can only be numeric.

Can someone help me figure this out? Thanks a lot.



The raw data looks like this:
Bucket NumPayments EndingBalance
CURRENT 4 of 3 $1,100,470
CURRENT More than four $1,421,711
DQ 1-29 1 of 3 $14,066
DQ 1-29 More than four $69,022
DQ 30-59 0 of 3 $49,248
DQ 60+ 2 of 3 $1,583,386
FOR 0 of 3 $1,093,786
FOR 1 of 3 $108,945
CURRENT 0 of 3 $170,992
DQ 1-29 3 of 3 $1,060,014
DQ 1-29 4 of 3 $494,159
DQ 30-59 2 of 3 $706,432
DQ 30-59 4 of 3 $57,560
DQ 60+ 3 of 3 $665,481
CURRENT 2 of 3 $655,793
CURRENT 3 of 3 $9,413,807
DQ 30-59 1 of 3 $146,652
DQ 60+ 0 of 3 $997,354
REO 0 of 3 $327,882
DQ 1-29 2 of 3 $1,102,146
DQ 30-59 3 of 3 $491,350
DQ 60+ 1 of 3 $271,282
DQ 60+ 4 of 3 $510,487
DQ 60+ More than four $91,675


The pivot'ed data looks like this:

Bucket 0 of 3 1 of 3 2 of 3 3 of 3 4 of 3 More than four
CURRENT 1.34% 5.14% 73.76% 8.62% 11.14%
DQ 1-29 0.51% 40.23% 38.70% 18.04% 2.52%
DQ 30-59 3.39% 10.11% 48.68% 33.86% 3.97%
DQ 60+ 24.21% 6.59% 38.43% 16.15% 12.39% 2.23%
FOR 90.94% 9.06%
REO 100.00%








0008_c263b436.jpg

3 Replies

VV Venkata Vijayaraj B Syncfusion Team August 20, 2009 11:25 AM UTC

Hi Robert,

It is possible to achieve this by using 'chartControl1.ChartFormatAxisLabel' event in Essential Chart Windows. I have given the code snippet below

for this. Please use it in your sample.

string[] arr = new string[] { "CURRENT", "DQ 1-29", "DQ 30 -59", "DQ60+", "FOR", "REO", "CUS", "TXT", "VAL", };

this.chartControl1.ChartFormatAxisLabel += new

Syncfusion.Windows.Forms.Chart.ChartFormatAxisLabelEventHandler(this.chartControl1_ChartFormatAxisLabel);


private void chartControl1_ChartFormatAxisLabel(object sender,

Syncfusion.Windows.Forms.Chart.ChartFormatAxisLabelEventArgs e)
{
int index = (int)e.Value + 1;
if (e.AxisOrientation == ChartOrientation.Horizontal)
{
string CustomText = this.textBox1.Text;
if (index < arr.Length)
{
e.Label = arr[index].ToString();
}
}
e.Handled = true;
}


Please let me know if this helps.

Regards,
Venkat.


RA Robert Avery August 21, 2009 06:40 PM UTC

Thanks! This fixed the formatting of the x-axis. It was giving me problems because I was binding the x-axis in the ChartSeries to a column in a datatable that had only text entries.

I have attached what the graph currently looks like.

Now I want to be able to do is put the legend entry or series name in to the graph inside of the colored bars, but ONLY if the bar is big enough to store such text. How do I do this?

I have updated my SyncFusion to 7.3.0.20, and I am working in VB.



velocity_8f37c088.jpg


VV Venkata Vijayaraj B Syncfusion Team August 24, 2009 11:05 AM UTC


Hi Robert,

Thank you for your patience.

It is no need to assign that binding the x-axis in the ChartSeries to a column in a datatable that had only text

entries. Because, When x-axis is not binded with any column, it takes the default index values as 1,2,3... and plot the data.


To display the texts inside the Column region:

ChartSeries series1=new ChartSeries();

//To display the text for whole series
series1.Style.DisplayText = true
series1.Style.Text = "Common Text for Series1" //Any Text

//To display the text for particular point.
series1.Styles[0].DisplayText = true
series1.Styles[0].Text = "First Point" //Any Text

//Use the below properties to arrange the location of Texts.
1. series1.Style.TextOffset = 1
2. series1.Style.TextOrientation = ChartTextOrientation.RegionCenter
3. series1.SmartLabels = true


Please let me know if this helps.

Regards,
Venkat.

Loader.
Live Chat Icon For mobile
Up arrow icon