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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...