Ejemplo n.º 1
0
 /// <summary>
 /// Sets/Resets properties of data sources to their defaults
 /// </summary>
 /// <param name="ds">Data source to reset</param>
 /// <param name="type">Type of data to reset</param>
 private void setAllGraphsToDeafault(DataSource ds, PointDataType type)
 {
     ds.Name                = type.ToString();
     ds.GraphColor          = generateColour((int)type);
     ds.OnRenderXAxisLabel += RenderXLabel;
     ds.AutoScaleY          = false;
     ds.SetDisplayRangeY((float)-3.5, (float)3.5);
     ds.SetGridOriginY(0);
     ds.SetGridDistanceY(1);
     ds.OnRenderYAxisLabel += RenderYLabel;
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Loads and calculates plot data points from XML nodes
        /// </summary>
        /// <param name="type">decides what type of data is being loaded in</param>
        private void calcData(PointDataType type)
        {
            float x, y;

            display.DataSources.Add(new DataSource());
            ds = display.DataSources[(int)type];
            setAllGraphsToDeafault(ds, type);
            var fData = doc.GetElementsByTagName(type.ToString());
            var i     = 0;

            foreach (XmlNode node_dataType in fData)
            {
                ds.Samples = new List <cPoint>();
                foreach (XmlNode node_dataPoint in node_dataType.ChildNodes)
                {
                    x = float.Parse(node_dataPoint.Attributes[0].Value);
                    y = (float)decimal.Parse(node_dataPoint.Attributes[1].Value, System.Globalization.NumberStyles.Float);
                    ds.Samples.Add(new cPoint(x * 1000, y * 1000));
                    ds.findExtremes(y);
                    i++;
                }
            }
        }