aafayad Posted October 23, 2008 Report Share Posted October 23, 2008 I have a datatable that has three column( id, AverageColor, AverageCost). I would like to have a serie for each row of that table. The bindingPath property will point to the AverageCost Field and the Fill property to be bound to the AverageColor Field. both fields are mapped to each other. I would like to achieve the following: <cfx:Chart.Series> <cfx:SeriesAttributes FillPath="AverageColor" BindingPath="AverageCost" /> </cfx:Chart.Series> Unfortunalty there is no FillPath property. Quote Link to comment Share on other sites More sharing options...
JuanC Posted October 25, 2008 Report Share Posted October 25, 2008 Although as you noted we do not expose a FillPath property you can achieve the chart you are looking for by changing the template we use to draw the chart markers (in this sample I am assuming it is a bar chart). <cfx:Chart Gallery="Bar" x:Name="chart1" ItemsSource="{Binding Source={StaticResource bidsData}}"> <cfx:Chart.Series> <cfx:SeriesAttributes BindingPath="AverageCost"/> </cfx:Chart.Series> <cfx:Chart.AllSeries> <cfx:AllSeriesAttributes> <cfx:AllSeriesAttributes.Template> <DataTemplate> <Rectangle Width="{Binding Path=Width}" Height="{Binding Path=Height}" Fill="{Binding Path=DataItem.AverageBrush}" /> </DataTemplate> </cfx:AllSeriesAttributes.Template> </cfx:AllSeriesAttributes> </cfx:Chart.AllSeries> <cfx:Chart.AxisX> <cfx:Axis> <cfx:Axis.Labels> <cfx:AxisLabelAttributes BindingPath="id> </cfx:Axis.Labels> </cfx:Axis> </cfx:Chart.AxisX> </cfx:Chart> Note that I am assuming a property called AverageBrush that returns a WPF brush, if you have a color property you can either create an extra property that returns a new SolidColorBrush using the color or you can also use a Converter in your binding. Regards, JuanC Quote Link to comment Share on other sites More sharing options...
aafayad Posted October 27, 2008 Author Report Share Posted October 27, 2008 Thank you, your solution worked perfect. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.