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

Stacking Column Chart ( Values of each "color" in the stack)

Hi everybody

I have two requests

1._ In the image I've attached, there a stacking columns chart. As all of you can see, there's a values for the orange column in the stack, I'm using C# in Visual Studio 2008 with aspx and the code snippet that basically activates those numbers is:

-----------------------------------------------------------------
ChartSeries series1 = new ChartSeries("Series1", ChartSeriesType.StackingColumn);

series1.Style.DisplayText = true;
-----------------------------------------------------------------

The problem is as all of you can see, the numbers are in the middle of the line of the column (In the image, the numbers are between the orange and the blue) and I want to know if there's a way to put down the number (the number 20 in the image must be just in the orange column).


2._ How can I show the sum value from the column stack in the above position in the column?

Best Regards.



stackingcol_3b8b3662.zip

3 Replies

VK Vijayabharathi K Syncfusion Team June 17, 2011 06:23 AM UTC

Hi Victor,

Thanks for using Syncfusion product.

1) there's a way to put down the number?

We suggest you to use “TextOrientation” property of series style to display the number within a column. Please refer the below code snippet to achieve this,

[C#]

this.chartControl1.Series[0].Style.TextOrientation = ChartTextOrientation.Down;

You can find more information about these properties in the online documentation link from below

http://help.syncfusion.com/ug_92/User%20Interface/ASP.NET/Chart/Documents/45184textorientation.htm

2) How can I show the sum value from the column stack in the above position in the column?

If your intention is to display the sum value in top of stacking column, we suggest you to use “CustomPoints” feature to display the sum value in top of stacking column. Please refer the below code snippet to achieve this,

[C#]

for (int i = 0; i < 5; i++)
{
ChartCustomPoint cp = new ChartCustomPoint();
double sum = series1.Points[i].YValues[0] + series2.Points[i].YValues[0] + series3.Points[i].YValues[0] + series4.Points[i].YValues[0];
cp.Text = "Sum:" + " " + sum;
cp.CustomType = Syncfusion.Windows.Forms.Chart.ChartCustomPointType.ChartCoordinates;
cp.Alignment = ChartTextOrientation.Up;
cp.XValue = i;
cp.YValue = sum;
cp.Color = Color.Black;
cp.Font.Bold = true;
cp.Font.Facename = "Verdana";
cp.Font.Size = 10F;
this.ChartWebControl1.CustomPoints.Add(cp);
}
You can find more information about these properties in the online documentation link from below

http://help.syncfusion.com/ug_92/User%20Interface/ASP.NET/Chart/Documents/453custompoints.htm

Please refer the attached screenshot for both queries.

Let us know if we misunderstood your query please provide us some clear details or screenshots about your requirement.

Regards,
Vijayabharathi






ScreenShot_ae994df0.zip


VE victor elizondo June 20, 2011 09:44 PM UTC

Hi Vijayabharathi

Thanks a lot for you useful help. Now I've solved this problem.

Best Regards.
Víctor



VK Vijayabharathi K Syncfusion Team June 21, 2011 04:50 AM UTC

Hi Victor,

Thanks for the update.

please let us know if you need further assistance

Regards,
Vijayabharathi


Loader.
Live Chat Icon For mobile
Up arrow icon