Click here to Skip to main content
15,891,033 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello,

I want to apply a Financial Formula, but I receive this error if I specify a specific Y value to use for an input value. I really don't understand why...

This is my (sample) code:

VB
Chart mychart = new Chart();

Series sInput = new Series("sInput");
Series sOut = new Series("sOut");

mychart.Series.Add(sInput);
mychart.Series.Add(sOut);

DataPoint dp = new DataPoint(1, new double[] { 5, 7, 3 });
sInput.Points.Add(dp);

dp = new DataPoint(2, new double[] { 3, 4, 1 });
sInput.Points.Add(dp);

dp = new DataPoint(3, new double[] { 5, 10, 1 });
sInput.Points.Add(dp);

dp = new DataPoint(4, new double[] { 8, 9, 8 });
sInput.Points.Add(dp);

dp = new DataPoint(5, new double[] { 15, 16, 14 });
sInput.Points.Add(dp);

mychart.DataManipulator.FinancialFormula(FinancialFormula.MovingAverage, "3", "sInput:Y2", "sOut");


This is the error I receive:

"System.ArgumentException {"Formula Error - Invalid Y value index.\r\nNome parametro: Y2"}"



P.S.: If I'd use the first Y Value my program works well ("sInput:Y" instead of "sInput:Y2")

Thanks in advance. I am waiting for the help please.

Regards,
Ghanzanfar Latif

[edit]code blocks added[/edit]
Posted
Updated 22-Dec-12 12:59pm
v4
Comments
Nelek 22-Dec-12 19:01pm    
Where are you declaring, giving values or whatever you do with Y2 and Y? The code you have posted bring no information about them. And those are the key of the problem.

1 solution

C#
// ChartType Default value <-- fails with sInput:Y2
sInput.ChartType = SeriesChartType.Column;

// ChartType with a single Y axis <-- fails with sInput:Y2
sInput.ChartType = SeriesChartType.Line;

// ChartType that has a Y and Y2 axis <-- passes with sInput:Y2
sInput.ChartType = SeriesChartType.Range;

http://msdn.microsoft.com/en-us/library/system.web.ui.datavisualization.charting.series.charttype.aspx[^]

I wasn't able to find much of a description of the differences between Chart Types but I only looked for a few minutes; I hope this helps you down the correct path.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900