コード例 #1
0
ファイル: GraphEngine.cs プロジェクト: litdev1/LitDev
        public seriesData createSeries(string seriesLabel, Primitive data, string colour, eLineType type)
        {
            Type PrimitiveType = typeof(Primitive);
            Dictionary<Primitive, Primitive> _arrayMap;
            seriesData _series = new seriesData();
            double x, y;

            try
            {
                data = Utilities.CreateArrayMap(data);
                _arrayMap = (Dictionary<Primitive, Primitive>)PrimitiveType.GetField("_arrayMap", BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.IgnoreCase | BindingFlags.Instance).GetValue(data);

                foreach (KeyValuePair<Primitive, Primitive> kvp in _arrayMap)
                {
                    x = (double)kvp.Key;
                    y = (double)kvp.Value;
                    _series.dataX.Add(x);
                    _series.dataY.Add(y);
                    _series.minX = System.Math.Min(_series.minX, x);
                    _series.minY = System.Math.Min(_series.minY, y);
                    _series.maxX = System.Math.Max(_series.maxX, x);
                    _series.maxY = System.Math.Max(_series.maxY, y);
                    _series.type = type;
                }
            }
            catch (Exception ex)
            {
                Utilities.OnError(Utilities.GetCurrentMethod(), ex);
            }

            _series.colour = colour;
            _series.name = seriesLabel;

            return _series;
        }
コード例 #2
0
ファイル: GraphEngine.cs プロジェクト: litdev1/LitDev
 public void CopyFrom(seriesData from)
 {
     name = from.name;
     minX = from.minX;
     maxX = from.maxX;
     minY = from.minY;
     maxY = from.maxY;
     dataX.Clear();
     dataY.Clear();
     foreach (double value in from.dataX) dataX.Add(value);
     foreach (double value in from.dataY) dataY.Add(value);
     //dataX = from.dataX;
     //dataY = from.dataY;
     colour = from.colour;
     type = from.type;
 }