Series values multiplier

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Luigi S.
Newbie
Newbie
Posts: 25
Joined: Tue Aug 21, 2007 12:00 am

Series values multiplier

Post by Luigi S. » Fri Dec 05, 2008 4:03 pm

Hi All,
I am using TeeChart for .NET (ver. 3.5.3146.24805).

I remember that in an older version of TeeChart (I worked with it it under Borland C++ Builder 5.0 some yeas ago) in the ValueList class there was a double property called "Multiplier" that was a multiplication factor for all the values inside the ValueList object, but I can't find it in the .NET version of TeeChart :? ....

Is something similar still available ?

Thanks.
Luigi S.
(using TeeChart for .NET ver. 3.5.3330.21113 with Microsoft Visual Studio 2005 SP1)

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 Dec 05, 2008 4:07 pm

Hi Luigi,

Do you mean the multiply function? There's an example of this at All Features\Welcome !\Functions\Standard\Multiply in the features demo. For more information about TeeChart functions please read Tutorial 7 - Working with Functions. Tutorials and demo can be found at TeeChart's program group.
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

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 Dec 05, 2008 4:11 pm

Hi Luigi,

As an update, I see this property is obsolete now in the VCL version and it doesn't exist in .NET. Anyway I think multiply function could help or you could also use something like this:

Code: Select all

			for (int i = 0; i < tChart1[0].Count; i++)
			{
				tChart1[0].YValues[i] *= 5;
			}
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

Luigi S.
Newbie
Newbie
Posts: 25
Joined: Tue Aug 21, 2007 12:00 am

Post by Luigi S. » Fri Dec 05, 2008 4:38 pm

narcis wrote:Hi Luigi,

Anyway I think multiply function could help
Hi Narcís ,
If I understood correctly :wink: the multiply function allows to multiply two series A and B and show the resulting function C...

In my case I should multiply all values of A for a constant value, keeping the original values inside the A series: is it possible to do this avoiding to add a point with value K (the multiply factor) into B for each point inside A, but simply one point of value K ?

Thanks.
Luigi S.
(using TeeChart for .NET ver. 3.5.3330.21113 with Microsoft Visual Studio 2005 SP1)

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

Post by Narcís » Tue Dec 09, 2008 12:45 pm

Hi Luigi,

In that case you can use series marks and GetSeriesMark and GetAxisLabel event like this:

Code: Select all

    public Form1()
    {
      InitializeComponent();
      InitializeChart();
    }

    private double multiplyFactor = 5;
    
    private void InitializeChart()
    {
      Steema.TeeChart.Styles.Bar bar1 = new Steema.TeeChart.Styles.Bar(tChart1.Chart);

      bar1.FillSampleValues();
      bar1.Marks.Visible = true;
      bar1.Marks.Style = Steema.TeeChart.Styles.MarksStyles.Value;

      bar1.GetSeriesMark += new Steema.TeeChart.Styles.Series.GetSeriesMarkEventHandler(bar1_GetSeriesMark);
      tChart1.GetAxisLabel += new Steema.TeeChart.GetAxisLabelEventHandler(tChart1_GetAxisLabel);
    }

    void tChart1_GetAxisLabel(object sender, Steema.TeeChart.GetAxisLabelEventArgs e)
    {
      if (sender == tChart1.Axes.Left)
      {
        double tmp = Convert.ToDouble(e.LabelText) * multiplyFactor;
        e.LabelText = tmp.ToString();
      }
    }

    void bar1_GetSeriesMark(Steema.TeeChart.Styles.Series series, Steema.TeeChart.Styles.GetSeriesMarkEventArgs e)
    {
      double tmp = Convert.ToDouble(e.MarkText);
      e.MarkText = Convert.ToString(tmp * multiplyFactor);
    }
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