Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# .NET VB.NET
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:
 
            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 20-Dec-12 13:31pm
Edited 22-Dec-12 12:59pm
Nelek49.1K
v4
Comments
Nelek at 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

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

// 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.
  Permalink  

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

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 495
1 OriginalGriff 339
2 ChintanShukla 305
3 Richard Deeming 235
4 RyanDev 230
0 Sergey Alexandrovich Kryukov 8,858
1 OriginalGriff 7,451
2 CPallini 2,603
3 Richard MacCutchan 2,095
4 Abhinav S 1,893


Advertise | Privacy | Mobile
Web02 | 2.8.140827.1 | Last Updated 24 Dec 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100