private void FillData() { NChart chart = nChartControl1.Charts[0]; NTriangulatedSurfaceSeries surface = (NTriangulatedSurfaceSeries)chart.Series[0]; Stream stream = null; BinaryReader reader = null; try { // fill the XYZ data from a binary resource stream = NResourceHelper.GetResourceStream(GetType().Assembly, "DataXYZ.bin", "Nevron.Examples.Chart.Wpf.Resources"); reader = new BinaryReader(stream); int nDataPointsCount = (int)stream.Length / 12; //surface.Data.SetCapacity(nDataPointsCount); NVector3DF[] data = new NVector3DF[nDataPointsCount]; // fill Y values for (int i = 0; i < nDataPointsCount; i++) { data[i].Y = reader.ReadSingle(); } // fill X values for (int i = 0; i < nDataPointsCount; i++) { data[i].X = reader.ReadSingle(); } // fill Z values for (int i = 0; i < nDataPointsCount; i++) { data[i].Z = reader.ReadSingle(); } for (int i = 0; i < nDataPointsCount; i++) { surface.Data.AddValue(data[i]); } } finally { if (reader != null) { reader.Close(); } if (stream != null) { stream.Close(); } } }
private void FillData() { NChart chart = nChartControl1.Charts[0]; NTriangulatedSurfaceSeries surface = (NTriangulatedSurfaceSeries)chart.Series[0]; Stream stream = null; BinaryReader reader = null; try { // fill the XYZ data from a binary resource stream = NResourceHelper.GetResourceStream(GetType().Assembly, "DataXYZ.bin", "Nevron.Examples.Chart.WinForm.Resources"); reader = new BinaryReader(stream); int nDataPointsCount = (int)stream.Length / 12; NTriangulatedSurfaceData surfaceData = surface.Data; surfaceData.SetCount(nDataPointsCount); surfaceData.UseColors = true; // fill Y values and colors for (int i = 0; i < nDataPointsCount; i++) { float y = 300 - reader.ReadSingle(); surfaceData.SetYValue(i, y); surfaceData.SetColor(i, GetColorFromValue(y)); } // fill X values for (int i = 0; i < nDataPointsCount; i++) { surfaceData.SetXValue(i, reader.ReadSingle()); } // fill Z values for (int i = 0; i < nDataPointsCount; i++) { surfaceData.SetZValue(i, reader.ReadSingle()); } } finally { if (reader != null) { reader.Close(); } if (stream != null) { stream.Close(); } } }
/// <summary> /// Loads the data for the tree map /// </summary> /// <returns></returns> private XmlDocument LoadData() { Stream stream = NResourceHelper.GetResourceStream(GetType().Assembly, "TreeMapDataSmall.xml", "Nevron.Examples.Chart.WinForm.Resources"); if (stream == null) { return(null); } XmlDocument document = new XmlDocument(); document.Load(stream); return(document); }
private void FillSurfaceData() { NChart chart = nChartControl1.Charts[0]; NTriangulatedSurfaceSeries surface = (NTriangulatedSurfaceSeries)chart.Series[0]; Stream stream = null; BinaryReader reader = null; try { // fill the XYZ data from a binary resource stream = NResourceHelper.GetResourceStream(GetType().Assembly, "DataXYZ.bin", "Nevron.Examples.Chart.WinForm.Resources"); reader = new BinaryReader(stream); int nDataPointsCount = (int)stream.Length / 12; // fill Y values for (int i = 0; i < nDataPointsCount; i++) { surface.Values.Add(reader.ReadSingle()); } // fill X values for (int i = 0; i < nDataPointsCount; i++) { surface.XValues.Add(reader.ReadSingle()); } // fill Z values for (int i = 0; i < nDataPointsCount; i++) { surface.ZValues.Add(reader.ReadSingle()); } } finally { if (reader != null) { reader.Close(); } if (stream != null) { stream.Close(); } } }
private void FillData() { NChart chart = nChartControl1.Charts[0]; NGridSurfaceSeries surface = (NGridSurfaceSeries)chart.Series[0]; Stream stream = null; BinaryReader reader = null; try { // fill the XYZ data from a binary resource stream = NResourceHelper.GetResourceStream(GetType().Assembly, "DataY.bin", "Nevron.Examples.Chart.WinForm.Resources"); reader = new BinaryReader(stream); int dataPointsCount = (int)(stream.Length / 4); int sizeX = (int)Math.Sqrt(dataPointsCount); int sizeZ = sizeX; surface.Data.SetGridSize(sizeX, sizeZ); for (int z = 0; z < sizeZ; z++) { for (int x = 0; x < sizeX; x++) { surface.Data.SetValue(x, z, reader.ReadSingle()); } } } finally { if (reader != null) { reader.Close(); } if (stream != null) { stream.Close(); } } }
private void FillData(NGridSurfaceSeries surface, NGridSurfaceSeries contour) { Stream stream = null; BinaryReader reader = null; try { // fill the XYZ data from a binary resource stream = NResourceHelper.GetResourceStream(GetType().Assembly, "DataY.bin", "Nevron.Examples.Chart.Wpf.Resources"); reader = new BinaryReader(stream); int dataPointsCount = (int)(stream.Length / 4); int sizeX = (int)Math.Sqrt(dataPointsCount); int sizeZ = sizeX; surface.Data.SetGridSize(sizeX, sizeZ); contour.Data.SetGridSize(sizeX, sizeZ); for (int z = 0; z < sizeZ; z++) { for (int x = 0; x < sizeX; x++) { double value = 300 + 0.3 * (double)reader.ReadSingle(); surface.Data.SetValue(x, z, value); contour.Data.SetValue(x, z, value); } } } finally { if (reader != null) { reader.Close(); } if (stream != null) { stream.Close(); } } }