Jump to content
Software FX Community

HighLowClose chart - how to configure data


mheydt

Recommended Posts

Passing data using XML (hardcoded for simplicity)

<

XmlDataProvider x:Key="MyData"><x:XData><OHLCData xmlns=""><OHLC Low="20" High="30" Open="22" Close="26"/><OHLC Low="20" High="30" Open="26" Close="22"/></OHLCData></x:XData></XmlDataProvider>

HighLowClose chart

<

cfx:Chart Gallery="HighLowClose" x:Name="chart1"><cfx:Chart.ItemsSource>  <Binding Source="{StaticResource MyData}" XPath="OHLCData/OHLC" /></cfx:Chart.ItemsSource><cfx:Chart.Series>   <cfx:SeriesAttributes BindingPath="@Low"/>   <cfx:SeriesAttributes BindingPath="@Close"/>   <cfx:SeriesAttributes BindingPath="@High"/></cfx:Chart.Series></cfx:Chart>

OpenHighLowClose chart

<

cfx:Chart Gallery="OpenHighLowClose" x:Name="chart1"><cfx:Chart.ItemsSource>  <Binding Source="{StaticResource MyData}" XPath="OHLCData/OHLC" /></cfx:Chart.ItemsSource><cfx:Chart.Series>   <cfx:SeriesAttributes BindingPath="@Low"/>   <cfx:SeriesAttributes BindingPath="@Open"/>   <cfx:SeriesAttributes BindingPath="@Close"/>   <cfx:SeriesAttributes BindingPath="@High"/></cfx:Chart.Series></cfx:Chart>

The important part is the order of the series, this should be the same order if you are passing data in code, either manually passing data or creating a collection of CLR objects that represent the data.

Regards,

JuanC

Link to comment
Share on other sites

The axis on the bottom is the X axis (Chart.AxisX), if you have labels (dates or strings) you can use them as follows

<

XmlDataProvider x:Key="MyData"><x:XData><OHLCData xmlns=""><OHLC Low="20" High="30" Open="22" Close="26" Label="Jan"/><OHLC Low="20" High="30" Open="26" Close="22" Label="Feb"/></OHLCData></x:XData></XmlDataProvider>

And inside the Chart tag you would add the following

<cfx:Chart.AxisX><cfx:Axis LabelPath="@Label"/></cfx:Chart.AxisX>

JuanC

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...