plus/minus format for values

Thread is closed for posting
4 posts, 0 answers
  1. John Giblin
    John Giblin avatar
    155 posts
    Member since:
    Jan 2006

    Posted 17 Sep 2010 Link to this post

    In the datatable in the rad chart I would like the values have a + sign if it is a positive number. Is that possible
  2. Evgenia
    Admin
    Evgenia avatar
    1437 posts

    Posted 22 Sep 2010 Link to this post

    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
  3. John Giblin
    John Giblin avatar
    155 posts
    Member since:
    Jan 2006

    Posted 22 Sep 2010 Link to this post

    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;

     

            }

        }

    }

     

  4. Evgenia
    Admin
    Evgenia avatar
    1437 posts

    Posted 24 Sep 2010 Link to this post

    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
Back to Top