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
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
Hi Pedro,
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,
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
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.
Please let me know if you have any additional questions.
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.