Everyone,
I'm working on a xamdatachart that would need to chart two series (common x axis but two y axes). I'm using the following xaml code but I can't seem to figure out the background code to accomplish this.
<
="True">
>
="yAxis" />
="xmYAxis">
<!--MinimumValue="100"
MaximumValue="10000">-->
="#FF69177C"
="12"
="Center"
="OutsideRight"
=Value}"
=Value}" />
="{}{Label}"/>
="2" />
="PriceSeries"
="Candlestick"
="ModifiedAverage"
}"
="Open"
="Close"
="High"
="Low"
="Volume"
=commonXAxis}"
=priceYAxis}">
</ig:XamDataChart.Series>
So, I've got two NumericYaxes which I'm guessing would let me chart two series but I can't seem to figure out how to accomplish it. When I try to add the second series, the chart only charts the second and ignores the second series. This is the code behind:
var data = from row in backtestTable
.Rows.OfType<
DataRow>()
select new DataItem()
{
Label = (
string)row["Date"].ToString(),
Value =
double.Parse(row["Price"].ToString())
};
backtestChart.DataContext = data;
data =
from row in backtestTable
double.Parse(row["Sales"].ToString())
backtestChart.Series[
"Test"].DataContext = data;
I would really appreciate any help.
Thanks,
K
Please see:
http://ko.infragistics.com/community/forums/p/71286/366652.aspx#366652
Thanks for the response Stefan. Apologies for my late reply, I've been on a break!
I have multiple object collections that are used, one for each different series on the chart. The X-axis will be of the same type, and in the case of a CategoryXAxis, will be based on the same data. However, the X-axis values will not necessarily match up perfectly, i.e. you might have values A, B, C and D on series 1, but only A, B and D on series 2.
I've come as far as having them actually render on the same CategoryXAxis, but the values don't line up on the axis labels - series 1 will have values matching up to the axis labels, but series 2 will be sliglhtly off - value B drawn over label A for example.
I will try and get an example app going to illustrate.
Reinhardt
Hello,
It has been a while since you have made your post, in case you still need support I will be glad to assist you further. I suppose the other community members can benefit from this answer as well. I have been looking into it and I can suggest you see this forum thread:
http://ko.infragistics.com/community/forums/t/78217.aspx?PageIndex=1
where a similar issue is discussed. Also I can say that if you want to use different collections for the different Series, you should have different CategoryXAxes, too.
Feel free to write me if you have further questions.
Sorry to revive this old thread - but I am beating my head against the wall on a similar issue.
We use these controls in a generic system, where the user can define his / her own charts using the generic data and layouts. In XamChart we had the ability to define multiple series on a chart quite happily, using completely disparate object sets per series. It seems to me that in the XamDataChart, this is not possible, as the bindings only cater for one (CategoryDateTime) X-axis, with the Y-axis values for different series coming from different properties from the SAME X-Axis DataContext?
In other words, using ChartDataPoint definitions as follows would simply not work if you have a collection of these for each series?
(simplified)
class MyDataPoint { object XAxisValue; object YAxisValue; }
You CAN ONLY define multiple series on one shared CategoryDateTimeXAxis using an object that looks like this:
class YourDataPoint { object XAxisValue; object YAxisValueSeries1; object YAxisValueSeries2; ...etc. }
Please let me know what you think - and for the love of all that is sweet and beautiful, correct me if I'm wrong, or give me an example of how I can use the first object and not have to use the second?
Thank you very much!
It would be very useful if "series of all equal length and interval" was not a requirement. XY charts tend to be technical data and you may have a different sampling interval, points get thrown out, or points are not collected. To make the chart work you then have to massage your data to try to meet this requirement.
I experienced the very same thing when I first tried to use the chart and it took a while to figure out what was going on.