Click here to Skip to main content
13,250,043 members (68,831 online)
Rate this:
Please Sign up or sign in to vote.
See more:

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");
            DataPoint dp = new DataPoint(1, new double[] { 5, 7, 3 });
            dp = new DataPoint(2, new double[] { 3, 4, 1 });
            dp = new DataPoint(3, new double[] { 5, 10, 1 });
            dp = new DataPoint(4, new double[] { 8, 9, 8 });
            dp = new DataPoint(5, new double[] { 15, 16, 14 });
            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.

Ghanzanfar Latif

[edit]code blocks added[/edit]
Posted 20-Dec-12 14:31pm
Updated 22-Dec-12 13:59pm
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

Rate this: bad
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;[^]

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.

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web02 | 2.8.171114.1 | Last Updated 24 Dec 2012
Copyright © CodeProject, 1999-2017
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