Dear Infragistics Team,
i think my questions are related with "CrosshairLayer which handles the data annotations that follow the mouse" please i really appreciate your help:
1) I wanna resize the markers on the scatter lines series (in the ultradatachart i wanna make bigger makers)
2) I wanna highlight the points inside the chart with movement mouse event (when the crosshair lines pass throught the points chart, the point chart hightlight).
can you helpme on vb.net sample?. I really appreciate your help.
Sincerily,
Pedro Salvador
Hi Pedro,
Thank you for posting in our forums.
The chart doesn’t have the capability to resize markers or highlight them out of the box. However what you can do in this case is to use a BubbleSeries with the same X and Y values as the ScatterLineChart and then specify the size of the bubbles by using the RadiusMemberPath property. In that case the bubbles will be the markers of the scatter line chart with a size determined by their radius property. As for the highlighting, you can use the FillScale property of the BubbleSeries. Create a ValueFillScale and set its minimum value and maximum value to 0 and 1 respectively. Add two brushes to the scale for the normal and highlighted colors. Then add a fill member in your data source and set all initial values to 0. Then in the SeriesMouseEnter event set the fill property of the item to 1, instead of zero. This will make the item have the highlighted color. Then in the SeriesMouseLeave event set its value back to 0.
I have attached a sample which demonstrates this suggestion.
Please let me know if you have any additional questions.
Dear Dimitar,
Thank you so much for answer me. I wanna reply the event that you have on your website on this page: http://labs.infragistics.com/silverlight/Showcases/Stocks/
The event i wanna reply is the crosshair lines pass throught the chart, the point follows the the crosshair, please. Can you helpme with a vb.net example?
Please i really need help with that.
Hi Salvador,
Thank you for the reply.
This can be achieved with the chart annotation layers. By adding a chart annotation layer you can easily create a similar chart. You need to use a CategoryHighlight, CategoryItemHighlight, CategoryTootlip layers in order to show the moving line, marker and tooltip in the chart. For more information about these layers, please see this link:
http://help.infragistics.com/Help/Doc/WinForms/2015.2/CLR4.0/html/DataChart_ChartAnnotationLayers.html
I have modified my sample in order to demonstrate this suggestions.
Thankyou so much for answerme, i have another question, please, can you helpme?.
I create the function that attached below, but throws a error : "a type " infragistics.portable.rect " value can not be converted into " System.Drawing.Rectangule ". The function shows on a label the coordinate X, Y on the chart. please, can you helpme with the mistake?. I write on the code where is the error.
Private Sub UDCObject_MouseMove(sender As Object, e As MouseEventArgs) Handles UDCObject.MouseMove ' gets the series and if nothing exits the sub Dim Series As ScatterLineSeries = Me.UDCObject.Series(0) If Series Is Nothing Then Return End If ' gets the axes and if any of them is nothing exits the sub Dim XAxis As NumericXAxis = DirectCast(Series.SeriesViewer, UltraDataChart).Axes.OfType(Of NumericXAxis).FirstOrDefault() Dim YAxis As NumericYAxis = DirectCast(Series.SeriesViewer, UltraDataChart).Axes.OfType(Of NumericYAxis).FirstOrDefault() If XAxis Is Nothing Or YAxis Is Nothing Then Return End If ' Get the actual X and Y values form the mouse current position and put the result in the label Dim Viewport As System.Drawing.Rectangle = Series.ExportVisualData().Viewport '!!!!!!*************Here is the error********!!!!!!!!! Dim Window As System.Drawing.Rectangle = Series.SeriesViewer.WindowRect Dim IsInverted As Boolean = XAxis.IsInverted Dim Param As ScalerParams = New ScalerParams(Window, Viewport, IsInverted) Dim UnscaledX = XAxis.GetUnscaledValue(e.Location.X, Param) IsInverted = YAxis.IsInverted Param = New ScalerParams(Window, Viewport, IsInverted) Dim UnscaledY = YAxis.GetUnscaledValue(e.Location.Y, Param) Coordinates_UDC1.Text = String.Format("X={0:0.00} Y={1:0.00}", UnscaledX, UnscaledY) End Sub
I'll hope you can helpme again. Please Dimitar
Sincerily
Well as the error states the type if this property is Infragistics.Portable.Rect and not System.Drawing.Rectangle, so the cast can’t happen. Why are you using the ExportVisualData method to get the ViewPort? The UltraDataChart has a ViewportRect exposed along with the WorldRect. So you can use it instead of the one exposed by the ExportVisualData method:
Dim Viewport As System.Drawing.Rectangle = Series.SeriesViewer.ViewportRect
Let me know if you have any additional questions.
Dear Dimitar.
I'm sorry but i try to reply your sample in my code but i can't do it. The mistake is about the numeric axis "One type value " Infragistics.windatavisualization.numericXaxis " can not be converted into " Infragistics.windatavisualization.categoryAxisBase "
I use a scatter line with a numeric axis and binding real data. Please Dimitar, can you helpme in my code to do the events with hightlight and the tool tips, please.
I really appreciate your help.
Sub UDC_Object(Datagrid As DataGridView) UDCObject.ResetSeries() UDCObject.ResetAxes() Dim DataCentroide As DataPointsCollection = centroide() Dim DataImagen As DataPointsCollection = GetData(DG1, (Math.Round((DG1.RowCount / 1.5), 1))) Dim DataUpdateTimer As Timer = New Timer() DataUpdateTimer.Interval = 1 AddHandler DataUpdateTimer.Tick, AddressOf DataUpdateTimer_Tick DataUpdateTimer.Start() Dim xAxis As New NumericXAxis Dim yAxis As New NumericYAxis Dim SerieImagen As ScatterLineSeries = New ScatterLineSeries() Dim SerieCentroide As ScatterLineSeries = New ScatterLineSeries() Dim Propiedades As New Object_properties(DG1) Dim Xmin As Double = (Object_properties.Totalxmin) * 1.1 Dim Xmax As Double = (Object_properties.Totalxmax) * 1.1 Dim Ymin As Double = Object_properties.Totalymin Dim Ymax As Double = (Object_properties.Totalymax) * 1.1 Dim Inx As Double Dim Iny As Double Inx = Xmax + Math.Abs(Xmin) Iny = Ymax - Ymin 'SerieImagen.TransitionDuration = 0 SerieImagen.DataSource = DataImagen SerieImagen.IsHighlightingEnabled = True SerieImagen.ShowDefaultTooltip = True SerieImagen.XMemberPath = "X" SerieImagen.YMemberPath = "Y" SerieImagen.XAxis = xAxis SerieImagen.YAxis = yAxis SerieImagen.Thickness = 2 SerieImagen.Brush = New SolidColorBrush(Color.Black) SerieImagen.MarkerType = Infragistics.Win.DataVisualization.MarkerType.None Dim categoryHighlight As New CategoryHighlightLayer() categoryHighlight.TargetAxis = xAxis categoryHighlight.BandHighlightWidth = 2 categoryHighlight.Thickness = 0 categoryHighlight.Brush = SerieImagen.ActualBrush categoryHighlight.TransitionDuration = 1000 categoryHighlight.TransitionInDuration = 1000 Dim itemHighlight As New CategoryItemHighlightLayer() itemHighlight.TargetSeries = SerieImagen itemHighlight.Brush = itemHighlight.TargetSeries.ActualBrush itemHighlight.Outline = itemHighlight.TargetSeries.ActualOutline itemHighlight.TransitionDuration = 1000 itemHighlight.TransitionInDuration = 1000 Dim categoryTooltipLayer As New ItemToolTipLayer() categoryTooltipLayer.TargetSeries = SerieImagen categoryTooltipLayer.ShowDefaultTooltip = True categoryTooltipLayer.ShouldRenderAsOverlay = False 'Configuracion de la serie SerieCentroide.DataSource = DataCentroide SerieCentroide.IsHighlightingEnabled = True SerieCentroide.ShowDefaultTooltip = True SerieCentroide.XMemberPath = "X" SerieCentroide.YMemberPath = "Y" SerieCentroide.XAxis = xAxis SerieCentroide.YAxis = yAxis SerieCentroide.MarkerBrush = New SolidColorBrush(Color.Black) SerieCentroide.MarkerOutline = New SolidColorBrush(Color.Black) SerieCentroide.MarkerType = Infragistics.Win.DataVisualization.MarkerType.Circle SerieCentroide = New ScatterLineSeries 'Configuracion de los ejes coordenados xAxis.CrossingValue = 0 xAxis.TickLength = 3 xAxis.TickStroke = New SolidColorBrush(Color.Black) xAxis.TickStrokeThickness = 0.05 xAxis.Title = "meters(m)" xAxis.TitleFontFamily = "Arial Narrow" xAxis.TitleTextStyle = FontStyle.Bold xAxis.TitleTextColor = New SolidColorBrush(Color.Black) xAxis.TitleFontSize = 12 xAxis.LabelFontFamily = "Arial Narrow" xAxis.LabelTextColor = New SolidColorBrush(Color.Black) xAxis.LabelFontSize = 10 xAxis.MinimumValue = Xmin xAxis.MaximumValue = Xmax xAxis.Interval = Inx xAxis.MinorStroke = New SolidColorBrush(Color.WhiteSmoke) xAxis.MajorStroke = New SolidColorBrush(Color.DarkGray) xAxis.MajorStrokeThickness = 1 xAxis.MinorStrokeThickness = 0.1 xAxis.LabelExtent = 30 yAxis.CrossingValue = 0 yAxis.TickLength = 3 yAxis.TickStroke = New SolidColorBrush(Color.Black) yAxis.TickStrokeThickness = 0.01 yAxis.Title = "meters(m)" yAxis.TitleTextStyle = FontStyle.Bold yAxis.TitleFontFamily = "Arial Narrow" yAxis.TitleTextColor = New SolidColorBrush(Color.Black) yAxis.TitleFontSize = 12 yAxis.LabelFontFamily = "Arial Narrow" yAxis.LabelTextColor = New SolidColorBrush(Color.Black) yAxis.LabelFontSize = 10 yAxis.MinimumValue = Ymin yAxis.MaximumValue = Ymax yAxis.Interval = Iny yAxis.MajorStroke = New SolidColorBrush(Color.DarkGray) yAxis.MajorStrokeThickness = 1 yAxis.LabelExtent = 50 yAxis.MinorStroke = New SolidColorBrush(Color.WhiteSmoke) yAxis.MinorStrokeThickness = 0.1 'Configuracion del chart UDCObject.Title = "Digitized Picture" UDCObject.TitleFontFamily = "Arial Narrow" UDCObject.TitleFontSize = 18 UDCObject.TitleTextColor = New SolidColorBrush(Color.Black) UDCObject.TitleTextStyle = FontStyle.Bold UDCObject.BackColor = New SolidColorBrush(Color.WhiteSmoke) UDCObject.Axes.Add(xAxis) UDCObject.Axes.Add(yAxis) UDCObject.Series.Add(SerieImagen) UDCObject.Series.Add(SerieCentroide) UDCObject.Series.Add(itemHighlight) UDCObject.Series.Add(categoryHighlight) UDCObject.HorizontalZoomable = True UDCObject.VerticalZoomable = True End Sub
Sincerly,
Pedro
I am attaching a modified version of my sample, which uses 8000 data points along with the highlight and tooltip chart layers. Note that using a numeric data for the category axis is just the same as using any other data. The chart will simply use the data class’ ToString method to determine the X axis labels.
Thankyou so much for your answer. Regarding your comment "try to convert your scatter series to a category one". Can you helpme with a sample with a category chart (scatter line) If i use the category one, the events "higliht", "tooltips" are possibles?. The idea is to create a graph with 8,000 in real data time. The spacing doesn’t matter. Can you helpme please with a sample on vb.net, please Dimitar?
Unfortunately it seems that even though you can compile your solution with these layers even when you are using a scatter chart, they won’t work with it. At this point you have two options – either log a new product idea for highlight layers for scatter series form our product ideas site or try to convert your scatter series to a category one. This is possible if the intervals on one of the axis are equally spaced or their spacing doesn’t matter.
I'm sorry to bother again, but i can't reply the – the tooltip and the item highlight with the scatter data. Do you have any sample on vb.net with scatter line and real data binding. I'm binding like 80000 thounsand points. Can you helpme with the events, please Dimitar?. I really appreciate your help.
Sincerly
The numerical axes don’t support highlight layers, so you will need to remove the code for the CategoryHighlightLayer:
‘Dim categoryHighlight As New CategoryHighlightLayer()
‘categoryHighlight.TargetAxis = xAxis
‘categoryHighlight.BandHighlightWidth = 2
‘categoryHighlight.Thickness = 0
‘categoryHighlight.Brush = SerieImagen.ActualBrush
‘categoryHighlight.TransitionDuration = 1000
‘categoryHighlight.TransitionInDuration = 1000
This layer can be used only for category axes. Still the other two layers – the tooltip and the item highlight – should work properly so you can use them with your scatter data.