问题描述
您好,
我想应用财务公式,但如果我指定一个特定的Y值用于输入值,我会收到此错误。我真的不明白为什么......
这是我的(样本)代码:
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"}"
PS:如果我使用第一个Y值我的程序运行良好(sInput:Y而不是sInput:Y2)
提前致谢。我正在等待帮助。
问候,
Ghanzanfar Latif
[edit]已添加的代码块[/ edit]
推荐答案
// 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.
这篇关于公式错误 - 无效的Y值索引的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!