Group: Forum Members
Last Active: 11 Years Ago
Posts: 20,
Visits: 1
|
Hi,
I have a set of data consisting on coordenates (X,Y,Z) and a value for each coordenate (1,1,1,0.5; 1,2,1,0.90; ...) I need to represent in a chart a different color for each point depending on its value. I forget about the Z and use only the X and Y, as I manage to solve a different solution to show the values for a specific Z.
At the moment I am using a NChartControl with a serie of type NGridSurfaceSeries that I load with X, Y and value (surface.Data.SetValue(1, 1, 0.5))
The representation looks fine. However, now I need to show some specific points on the chart. These are not points that are in the serie that I represent. I also would need to implement functionality so the user can click somewhere on the chart (or pass over with the mouse) and the coordenates and value for the point is shown.
I cannot find the way to do this with this chart. Is it possible or should I change the type of chart (and if so, what chart or serie type should I use)?
Thanks,
IM
|
Group: Forum Members
Last Active: Last Week
Posts: 3,054,
Visits: 4,009
|
Hi Ignacio, Regarding the additional points - you can use a point series (NPointSeries type). Regarding the coordinates of the clicked point - please contact our support email, we will send you an example.
Best Regards, Nevron Support Team
|
Group: Forum Members
Last Active: 11 Years Ago
Posts: 20,
Visits: 1
|
Hi and thanks for the answer,
Regarding the coordinates of a clicked point, I have managed to find out the coordinates and display them together with the value of the point on a ritchtextbox.
However, I am now trying the additional points issue with the NPointSeries. I managed to add the points serie to the chart, but instead of displaying the points on the chart, I get them at the bottom of the chart in a completely misunderstandable format (overlapping, etc.).
I do:
Dim Serie_MyDataPointsAs NPointSeries = CType(NChartControl1.Charts(0).Series.Add(SeriesType.Point), NPointSeries) Serie_MyDataPoints.ClearDataPoints() Serie_MyDataPoints.DataLabelStyle.Visible = True Serie_MyDataPoints.PointShape = PointShape.LineCross Serie_MyDataPoints.LabelLayout.EnableDataPointSafeguard = True Serie_MyDataPoints.LabelLayout.UseLabelLocations = True Serie_MyDataPoints.Visible = True For iIdx As Integer = 0 To MyCollectionOfDataPoints.Count Serie_MyDataPoints.AddDataPoint(New NDataPoint(MyX , MyY, MyZ, MyLabel)) Next
I would also like to know if there is an already implemented zoom functionality.
Thanks,
Ignacio
|
Group: Forum Members
Last Active: Last Week
Posts: 3,054,
Visits: 4,009
|
Hi Ignacio, The code for the point looks OK, maybe the problem is with the point coordinates. In our chart Z values are scaled on the depth axis and Y values are displayed on the vertical axis. What happens if you swap Y and Z values? Regarding zooming - you can take a look at the following example in our Windows Forms demo application: All Examples > Interactivity > Tools > Data Zoom Tool It demonstrates the data zoom tool in 2D and 3D scenarios. You can select a 3D point chart from the "Sample chart" combo box.
Best Regards, Nevron Support Team
|
Group: Forum Members
Last Active: 11 Years Ago
Posts: 20,
Visits: 1
|
Hi,
I managed to use the zoom functionality by using your NChartCommandBarsManager However, the Mouse Offset tool is something I really will need to use and for some reason it is the only tool that does not work. I can click on the tool, click on the chart and try to drag but the chart does not move/refresh.
Regarding the points issue, I will give a try to your idea. However, let me attach the idea and code I am using:
I have a set of coordenates which represent a defined measured ground, with X,Y and Z, where Z is the depth (1 meter, 2 meters, ...) and a concentration of each coordenate. I forget about the Z value as I will focus on one value of Z only, and am trying to represent the value of concentration in a X,Y axis, as in the Examples --> Grid surface --> Contour. I have managed to do so, but as mentioned, now I need to implement the possibility to add specific points (like pins) having their X and Y. I also need to work with the chart specially with the mouse offset tool.
Public Sub Paint_Chart() NChartControl1.Clear() NChartControl1.Settings.ShapeRenderingMode = ShapeRenderingMode.Default NChartControl1.AllowDrop = True ' set a chart title Dim sTitle As String = "" If cboContaminante.Text <> "" Then sTitle = "Concentration of Pb " End If Dim title As NLabel = New NLabel(sTitle) title.TextStyle.FontStyle = New NFontStyle("Times New Roman", 18, FontStyle.Italic) title.TextStyle.FillStyle = New NColorFillStyle(Color.Black) ' setup chart Dim chart As NChart = NChartControl1.Charts(0) chart.Enable3D = False chart.Width = 70.0F chart.Depth = 70.0F chart.Height = 0.100000001F chart.Projection.SetPredefinedProjection(PredefinedProjection.OrthogonalTop) chart.LightModel.EnableLighting = False ' hide chart walls chart.Wall(ChartWallType.Back).Visible = False chart.Wall(ChartWallType.Left).Visible = False chart.Wall(ChartWallType.Floor).Visible = False ' setup Y axis chart.Axis(StandardAxis.PrimaryY).Visible = True ' setup X axis Dim axisX As NAxis = chart.Axis(StandardAxis.PrimaryX) axisX.Anchor = New NDockAxisAnchor(AxisDockZone.FrontTop) Dim scaleX As NLinearScaleConfigurator = New NLinearScaleConfigurator() scaleX.InnerMajorTickStyle.Visible = True scaleX.RoundToTickMin = False scaleX.RoundToTickMax = False axisX.ScaleConfigurator = scaleX
' setup Y axis Dim axisY As NAxis = chart.Axis(StandardAxis.Depth) axisY.Anchor = New NDockAxisAnchor(AxisDockZone.TopRight) Dim scaleY As NLinearScaleConfigurator = New NLinearScaleConfigurator() scaleY.InnerMajorTickStyle.Visible = False scaleY.MajorGridStyle.ShowAtWalls = New ChartWallType() {} scaleY.RoundToTickMin = False scaleY.RoundToTickMax = False axisY.ScaleConfigurator = scaleY
' add a surface series Dim surface As NGridSurfaceSeries = CType(chart.Series.Add(SeriesType.GridSurface), NGridSurfaceSeries) surface.Name = "Contour" surface.FillMode = SurfaceFillMode.Zone surface.FrameMode = SurfaceFrameMode.Contour surface.ShadingMode = ShadingMode.Flat surface.DrawFlat = True
surface.Data.SetGridSize(100, 100) ' setup a custom palette surface.AutomaticPalette = true ' fill the surface with data Fill_Data(surface) Fill_PDM(xMin - (xMin * (5 / 100)), yMin - (yMin * (5 / 100))) surface.FillMode = SurfaceFillMode.Zone surface.FrameMode = SurfaceFrameMode.Dots surface.SmoothPalette = True surface.FrameColorMode = SurfaceFrameColorMode.Zone ' apply layout ApplyLayoutTemplate(0, chart, title, NChartControl1.Legends(0)) End Sub
Private Sub Fill_Data(ByVal surface As NGridSurfaceSeries) 'read file with data. 'format of data in the file: 50;1;0;4,05|50;1;1;1,08|50;1;2;5,85... (X;Y;Z;value of concentration) Dim sline As String Using sr As New StreamReader(MyFile("C:\....")) sline = sr.ReadToEnd() End Using Dim sGroup() As String = sline.Split("|") For iIdx As Integer = 0 To sGroup.Length - 1 Dim sData() As String = sGroup(iIdx).Split(";") If sData.Length >= 2 Then If CInt(sData(2)) = 1 'Load only data from (X;Y;Z...) where Z = 1 surface.Data.SetValue(CInt(sData(0)), CInt(sData(1)), CDbl(sData(3))) end if End If Next End Sub
Sorry for the long message, and thanks for your patient.
Ignacio
|
Group: Forum Members
Last Active: Last Week
Posts: 3,054,
Visits: 4,009
|
Hi Ignacio, The example that you mentioned (Examples --> Grid surface --> Contour) actually displays the X and Z axes (Z is the vertical one). This is a 3D chart that is viewed "from above" with orthogonal projection. The Y axis is not visible - it measures the surface elevation and points towards the viewer. Regarding the mouse offset tool - it takes effect only if the chart panel is not using any kind of docking. The Dock property of the chart panel should be set to None: nChartControl1.Charts[0].Dock = DockStyle.None;
Best Regards, Nevron Support Team
|