Reputation: 832
I have a stacked bar chart where I want to display two values for the Y parameter at the method :
public void DataBindXY(
IEnumerable xValue,
string xField,
IEnumerable yValue,
string yFields
)
My problem is that I would like to have two values for Y and not just one, as mentioned at [MS documentation][1]
[1]: http://msdn.microsoft.com/en-us/library/dd488523.aspx , I tried putting at the yField parameter two values , and I am keep getting "You can only set 1 Y values for this data point. Parameter name: yValue"
here is an example of my code , while DV is a DataView object with three parameters, two applicable for Y axis and one applicable for X axis:
Points.DataBindXY(dv, "Xfield", dv, "Yfield1,Yfield2");
Thanks, David
Upvotes: 0
Views: 8598
Reputation: 38210
I think you just need to make it aware that your series needs 2 Y values, so just try setting
Chart1.Series[0].YValuesPerPoint = 2;
But as per Stacked Chart it only allows a single Y value per point.
In case you are looking for the values to be stacked up, then i think you would need equivalent number of series as the number of stacks you want which would then be rendered based upon their common X Values.
Series 1 --> Xfield,Yfield1
Series 2 --> Xfield,Yfield2
Upvotes: 3