Page 1 of 1
Series values multiplier
Posted: Fri Dec 05, 2008 4:03 pm
by 13046530
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.
Posted: Fri Dec 05, 2008 4:07 pm
by narcis
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.
Posted: Fri Dec 05, 2008 4:11 pm
by narcis
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;
}
Posted: Fri Dec 05, 2008 4:38 pm
by 13046530
narcis wrote:Hi Luigi,
Anyway I think multiply function could help
Hi NarcĂs ,
If I understood correctly
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.
Posted: Tue Dec 09, 2008 12:45 pm
by narcis
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);
}