Hi Infragistics,
I'm trying to highlight some data in a bar or column series. I want a few of the columns to be highlighted, not just one category. In an ideal world, most of the columns would be semi-opaque, and the highlighted columns would not.
I'm populating my data from a view model, so the normal WPF way is to have an 'IsHighlighted' property in each data point view model, and use a data trigger in a style in Xaml. All very neat.
Not so, apparently. I've seen some horrendous workarounds on the forum for the people who come across this problem. The most likely solution was a few hundred lines of code.
Note, some have suggested I use a series for each column and set the opacity there. That doesn't work in my scenario because I'm also creating clustered and stacked charts.
Help!
Thanks
Pete
Matt,
Check your code.
DataContext dc = r.DataContext as Infragistics.Controls.Charts.DataContext; WeeklyTotals wt = dc.Item as WeeklyTotals;
wt is always null, because you are not passing the data item through. I can't tell what data context you mean, your sentence is unfinished, but there is no route through there back to any of my classes to bind to. The rectangle data context does not have the data we need.
If you can just show me how to 'probably' bind the rectangles, or the columns, to classes that represent them (including multiple series scenarios) then we will be home and dry. Then we can select / multiselect bars in a chart, and we'll be happy. I can do this in the code, and in single series, just can't show which bars are selected to the user in multiple series scenarios.
It's been a week now, and we still don't have a resolution, so we're probably going to have to decide against using your bar chart. Let's hope we don't find similar shortcomings in your other chart types. I'm looking at line charts next, and I think i have examples on selecting values there. It's a shame, because we have nine or so annual licences with you over various technologies. We would have ideally hoped for a path forward on this project that includes Infragistics.
HI,
You can create a style targeting the Rectangle and wire up the PreviewMouseLeftDownbutton.
The rectangle DataContext will have the data you.
You can change the opacity and probably set up a binding to the class(object) each column represents.
Sincerely,
Matt Developer Support Engineer
Thanks Matt,
I've had a look at your sample, thanks. It sets the colour of a marker on mouse click. There are a few reasons why only being able to change the look in response to a mouse event is not a solution.
The use case is that users can select data from a multi-series bar chart by clicking on a bar. They can left click to select a single bar, or multi-select using ctrl+click. This is all working perfectly, except I've no way to change the look of the bar to show it's selected / deselected.
You're approach is problematic because there's no way I'm going to put a marker on the top of each bar just to show a selection. Non-data ink should be minimised, and it's a bit nasty looking. Also, there's a problem showing the other bars have been deselected in a single select scenario. It needs to react to changes in the data.
This should be a data trigger in a style, ten lines of xaml, and not three developer days and counting. I'm not stuck in mvvm though, I've already derived a new chart from XamDataChart to add support for a dynamic number of series. I'm open to any way this is possible to achieve.
The StyleBinder approach we've seen in other posts works for me in a single series, but not for multiple series.
Last night I thought I'd cracked it using your custom bindable infostrips example. I was hoping to show a selection using a faint vertical infostrip. Again, this worked fine for single series column charts, but couldn't be used to show the selection of a single column in a multi-series chart.
To avoid duplication, this is CAS-121153-V7K0Q3
thanks
I am attaching a sample that allows you to select a marker.
Please review my sample. LeftClick on a marker to select it.
Matt
Developer Support Engineer
I'm going to have to keep throwing development days at this, because it's a blocking issue for us here. We can get it to work in a chart that displays a single series, using help from this post:
http://es.infragistics.com/community/forums/t/51914.aspx
When we are showing multiple series on the same chart, we are struggling to bind the rectangle to the item source of the correct series.