Creating a line chart which takes the first value as 100%

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Tony
Newbie
Newbie
Posts: 5
Joined: Tue Apr 08, 2003 4:00 am
Location: ak@priso.net
Contact:

Creating a line chart which takes the first value as 100%

Post by Tony » Fri Jul 07, 2006 12:43 pm

Hi!

Is there any function or possibility to tell TeeChart that it should take the first of its datasource values as 100%, and the rest of the values should be the percentage in comparison to the first one?
I think its called "Performance-Chart" in business...

Or is it better or easier to create a function in the database that returns the percentages?

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Fri Jul 07, 2006 2:32 pm

Hi Tony,

Performance charts are not directly supported but I guess they can be easily achieved. For example you can do something like this:

Code: Select all

    private void AddPercentValue(double percent)
    {
      double value = bar1.YValues[0] * (percent / 100);

      if (percent > 100) 
      {
        bar1.Add(value, Color.Red);
      }
      else
        if (percent < 100)
        {
          bar1.Add(value, Color.Yellow);
        }
        else
        {
          bar1.Add(value, Color.Green);
        }

    }

    private void Form1_Load(object sender, EventArgs e)
    {
      //Set initial value
      bar1.Add(123, Color.Blue);

      //Add values as the percent of the original
      AddPercentValue(55);
      AddPercentValue(73);
      AddPercentValue(112);
      AddPercentValue(105);
      AddPercentValue(23);
      AddPercentValue(87);
      AddPercentValue(100);
      AddPercentValue(75);
      AddPercentValue(85);
    }
If that's not what you are trying to achieve don't hesitate to ask here and if possible give us more information on what would you exactly like to get.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply