I have a 2D stack chart, how do I show the value for each part of the stack bar on the chart?
I tried this but nothing happen:
ChartTextAppearance t = new ChartTextAppearance();t.Visible = true;t.ItemFormatString = "<DATA_VALUE_ITEM:#0.##>";t.Row = -2;t.Column = -2;t.HorizontalAlign = System.Drawing.StringAlignment.Center;
I put this piece of code just before I databind the chart.
Thanks
Hi,
You have done everything; now need to add “t” to the ChartText collection:
this.UltraChart1.BarChart.ChartText.Add(t);
Thanks,But in my code listed above I forget the following:UltraChart2.BarChart.ChartText.Clear();UltraChart2.BarChart.ChartText.Add(t);Even with those 2 lines, nothing happen.Should I put this code under a specific event?Thanks
I have following code, and it works for me. Do you want, I send a sample?
protected void Page_Load(object sender, EventArgs e)
{
ChartTextAppearance t = new ChartTextAppearance();
t.Visible = true;
t.ItemFormatString = "<DATA_VALUE_ITEM>";
t.Row = -2;
t.Column = -2;
t.HorizontalAlign = System.Drawing.StringAlignment.Center;
this.UltraChart1.DataSource = GetData();
this.UltraChart1.DataBind();
}
if the <DATA_VALUE_ITEM> format string (not <DATA_VALUE>) is used, the value displayed will be individual, not cumulative for the stack.
I have attached sample.
Yes please, thank you.