This is a migrated thread and some comments may be shown as answers.

plus/minus format for values

3 Answers 61 Views
Chart (Obsolete)
This is a migrated thread and some comments may be shown as answers.
John Giblin
Top achievements
Rank 1
John Giblin asked on 17 Sep 2010, 10:20 PM
In the datatable in the rad chart I would like the values have a + sign if it is a positive number. Is that possible

3 Answers, 1 is accepted

Sort by
0
Evgenia
Telerik team
answered on 22 Sep 2010, 04:06 PM
Hi John Giblin,

I'm sorry but there is no way to change the format of elements shown in PlotArea DataTable.
What I can offer you is to  append "+" operator in front of every SeriesItemLabel like this:

protected void myRadChart_BeforeLayout(object sender, EventArgs e)
  {
      foreach (ChartSeriesItem seriesItem in myRadChart.Series[0].Items)
      {
          if (seriesItem.YValue > 0)
          {
              seriesItem.Label.TextBlock.Text = "+" + seriesItem.Label.TextBlock.Text ;
          }
      }
  }
 
In order to do it you should subscribe for BeforeLayout event of the chart as shown below:

<telerik:RadChart runat="Server" ID="myRadChart" OnBeforeLayout="myRadChart_BeforeLayout">

Hope this helps.

Greetings,
Evgenia
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
John Giblin
Top achievements
Rank 1
answered on 22 Sep 2010, 07:44 PM
That didnt work.  I see it hitting the part where it is adding the plus sign but I dont see it


 

 

foreach (ChartSeries series in rcNetworkBroadcastChange.Series)

 

{

 

 

    foreach (ChartSeriesItem seriesItem in series.Items)

 

    {

 

 

        if (seriesItem.YValue > 0)

 

        {

            seriesItem.Label.TextBlock.Text =

 

"+" + seriesItem.Label.TextBlock.Text;

 

        }

    }

}

 

0
Evgenia
Telerik team
answered on 24 Sep 2010, 07:18 AM
Hello John Giblin,

As I mentioned in my first reply it is not possible to change the format of elements shown in PlotArea DataTable.
What I suggested was kind of workaround -  to have the plus sign shown in SeriesItemLabels of the chart.
The reason that you don't see the plus sign added to SeriesItemLabels is that you should make SeriesItemLabels visible in your chart. You can do it like this:

myRadChart.Series[0].Appearance.LabelAppearance.Visible = true;

Note that you should turn Visibility on for every Series that you have in your Chart. The code snippet shows how to do it for first Series only.

Kind regards,
Evgenia
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Chart (Obsolete)
Asked by
John Giblin
Top achievements
Rank 1
Answers by
Evgenia
Telerik team
John Giblin
Top achievements
Rank 1
Share this question
or