Hi,
I have a column chart and I would like to display information about the column pointed by the mouse. I dont want to use the tooltip, its position changes all the time and its disturbing. I want to put a TextBlock in my window that will act as a tooltip but the position will remain.
I would also like to change the look of the column when the cursor is over it. Ex : change the DataPointColor property or show the marker only when the mouse is over the column.
I cannot find the MousHover event.
(you can see an example of what I would like to do here)
http://ca.finance.yahoo.com/charts?s=%5EGSPTSE#chart6:symbol=^gsptse;range=3m;indicator=volume;charttype=line;crosshair=on;ohlcvalues=0;logscale=on;source=undefined
Thanks
Karine
About your second require to change the color of the DataPoint you can try the following :
Brush defaultBrush;
public Window1(){ InitializeComponent(); Loaded += new RoutedEventHandler(Window1_Loaded); }
void Window1_Loaded(object sender, RoutedEventArgs e) { EventManager.RegisterClassHandler(typeof(DataPoint),DataPoint.MouseEnterEvent,new MouseEventHandler(OnDataPointMouseEnter)); EventManager.RegisterClassHandler(typeof(DataPoint), DataPoint.MouseLeaveEvent, new MouseEventHandler(OnDataPointMouseLeave)); } void OnDataPointMouseEnter(object sender, MouseEventArgs e) { DataPoint currentPoint=e.Source as DataPoint; defaultBrush = currentPoint.Fill; textBlock.Text = currentPoint.Value.ToString(); currentPoint.Fill = Brushes.Red; } void OnDataPointMouseLeave(object sender, MouseEventArgs e) { DataPoint currentPoint = e.Source as DataPoint; textBlock.Text = ""; currentPoint.Fill = defaultBrush; }
Hope this helps
Best Regards
Vlad Zagorski
Developer Support Team
hi, i'm currently looking into the same feature, but it seems that if the DataPointColor set to Auto, the currentPoint.Fill will return null.
what i'm trying to do is: to get the color from the data point and use that to change the color of the textblock font color.
http://www.google.com/finance?q=INDEXDJX:.DJI,INDEXSP:.INX,INDEXNASDAQ:.IXIC
anyway to achieve this?
Thanks.
i'm not sure why currentPoint.Fill comes out to null, but try this:
<StackPanel> <igChart:XamChart> <igChart:XamChart.Series> <igChart:Series ChartType="Line"> <igChart:Series.Marker> <igChart:Marker /> </igChart:Series.Marker> <igChart:Series.DataPoints> <igChart:DataPoint Value="1" Fill="Red" /> <igChart:DataPoint Value="3" Fill="Green" /> <igChart:DataPoint Value="2" Fill="Blue" /> </igChart:Series.DataPoints> </igChart:Series> </igChart:XamChart.Series> </igChart:XamChart> <TextBox Text="hello" Height="25" Width="100" x:Name="theTextBox" /> </StackPanel>
public Window1() { InitializeComponent(); EventManager.RegisterClassHandler(typeof(DataPoint), DataPoint.MouseEnterEvent, new MouseEventHandler(OnDataPointMouseEnter)); } void OnDataPointMouseEnter(object sender, MouseEventArgs e) { DataPoint currentPoint = e.Source as DataPoint; this.theTextBox.Foreground = currentPoint.Fill; }
is something different in the sample you're using?
I am having the same issue as Bembengarifin. Are there any way to retrieve the colors, that will be generated behind the scenes, when using DataPointColor.Auto?
I am currently trying to make my custom Legend, in order to place the legend below the chartArea, having the legendItems orientated horisontally in the legend. But binding to the Fill property of the Serie, will not work as it is not set. Any other way to solve that.
I will gladly provide any further sample code if needed?
Dennis
Hi David, I'm currently populating the series dynamically from the code, and It seems that the Fill of Series/DataPoint will be null because of this.
To resolve that, I need to specify the brush explicitly for each series, then I can retrieve it during the mouse hover.
series.Fill = [some brush];