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
I recently discovered that all of the series sharing a category X axis must have the same number of items as the collection bound to the X axis. Only series with a matching number of items will be rendered, even though you can see them all in the legend.
Jon
Hi ,
I would like to re iterate your issue , I presume you are trying to plot the two LineSeries "PL" and "Test" with the same CategoryXAxis and seperate NumericYAxis for each of these.
If my presumption is correct , I notice in your Xaml pasted above that the YAxis for both of the LineSeries is the same ; the ElementName for the YAxis for both the LineSeries is "yAxis" . You would need to bind the second line series "Test" YAxis to "xmYAxis". I changed that in my sample and was able to plot both the LineSeries with the respective Axes. I have attached a screenshot of what i see.
If this is not what you are looking at , can you please attach a sample application showcasing your issue ?
Are you having problem creating a new Series at runtime with common XAxis and seperate YAxis that are defined in the Xaml ?
Shilpa