Hi,
I try to display several ScatterLineSeries in one xamDadaChart. Since they are unknown in count at designtime, I have to add them in code behind.
Previous first steps were made in LineSeries. Therein I managed to add a ToolTip in Code behind as well displaying Value and TimeStamp while hovering over the chart.
Now I was hoping that I would be able to simply copy and paste that snippet and it would work - I know, a little naive for a developer (I hope that caused a smile). You might have guessed it already, it did NOT work.
The following snippet compiles and runs. Unfortunately, it does not show up in the chart:
ScatterLineSeries series = new ScatterLineSeries();//some more code to initialize the scatter series//end of the initialisationStackPanel sp = new StackPanel(){ Orientation = System.Windows.Controls.Orientation.Vertical};var txtbl = new TextBlock();txtbl.SetBinding(TextBlock.TextProperty, new Binding("Series.Title"));sp.Children.Add(txtbl);txtbl = new TextBlock();txtbl.SetBinding(TextBlock.TextProperty, new Binding("Item.Value"));sp.Children.Add(txtbl);txtbl = new TextBlock();txtbl.SetBinding(TextBlock.TextProperty, new Binding("Item.DateString"));sp.Children.Add(txtbl);series.ToolTip = sp;
Yes, exactly that ...
Did I miss something?
Enrico
It has just occurred to me. Are you mousing over the line and the tooltip isn't showing up, or tha markers?
-Graham
Hi Graham,
No, there are no errors at all in my Output. A single Enumerator item looks like this:
public class DataElement{ private String _DateString = ""; private Double _DateValue = 0; private Double _Data = 0; public DataElement(String dateString, Double dateValue, Double data) { _DateString = dateString; _DateValue = dateValue; _Data = data; } public String DateString { get { return _DateString; } set { _DateString = value; } }
public Double DateValue { get { return _DateValue; } set { _DateValue = value; } } public DateTime DateValueDt { get { return DateTime.FromOADate(_DateValue); } } public Double Data { get { return _Data; } set { _Data = value; } } public Object Value { get { return _Data; } } public override string ToString() { return _DateString + ":" + _DateValue.ToString() + ":" + _Data.ToString(); }}
As you can see, this is a very simple container class. It worked amazingly nice in a sample with the LineSeries together with a CategoryXAxis. When I switched to ScatterLineSeries and NumericXAxis however, the ToolTip stopped working. If I can provide any further information, please ask. I will try to post them as soon as possible.
Thank you very much for your reply and your attempts to help.
Hi, do you see any binding errors in the output window when you run this? What do your items look like?