/// <summary> /// Converts from the specified value to the intended conversion type of the converter. /// </summary> /// <param name="context">An object that provides a format context.</param> /// <param name="culture">The <see cref="T:System.Globalization.CultureInfo" /> to use as the current culture.</param> /// <param name="value">The value to convert to the type of this converter.</param> /// <returns> /// The converted value. /// </returns> public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value) { List <string> result = ((string)value).Split(',').ToList(); for (int j = 0; j < result.Count; j++) { var point = result[j]; if (string.IsNullOrEmpty(point)) { result[j] = "0"; } } if (result.Count % 2 != 0) { result.Add("0"); } PointsCollection collection = new PointsCollection(); for (int i = 0; i < result.Count; i += 2) { collection.Add(new ChartPoint() { XValue = double.Parse(result[i].ToString(CultureInfo.InvariantCulture)), YValue = double.Parse(result[i + 1].ToString(CultureInfo.InvariantCulture)) }); } return(collection); }
/// <summary> /// Generates the points from source. /// </summary> public override void GeneratePointsFromSource() { base.GeneratePointsFromSource(); OpenValues = this.GetReflectionValues(this.OpenPath, PointsSource, OpenValues, false); CloseValues = this.GetReflectionValues(this.ClosePath, PointsSource, CloseValues, false); if (OpenValues != null && OpenValues.Count > 0) { this.openPoints = GetPointsFromValues(XValues, OpenValues); } if (CloseValues != null && CloseValues.Count > 0) { this.closePoints = GetPointsFromValues(XValues, CloseValues); } }
/// <summary> /// Gets the points from values. /// </summary> /// <param name="xValues">The x values.</param> /// <param name="yValues">The y values.</param> /// <returns></returns> protected PointsCollection GetPointsFromValues(List <double> xValues, List <double> yValues) { PointsCollection tempPoints = new PointsCollection(); for (int i = 0; (i < xValues.Count && i < yValues.Count); i++) { ChartPoint point = new ChartPoint() { XValue = xValues[i], YValue = yValues[i] }; tempPoints.Add(point); } return(tempPoints); }
/// <summary> /// Generates the points from source. /// </summary> public virtual void GeneratePointsFromSource() { XValues = this.GetReflectionValues(this.XPath, PointsSource, XValues, false); YValues = this.GetReflectionValues(this.LowPath, PointsSource, YValues, false); LowValues = YValues; lowPoints = new PointsCollection(); if (XValues != null && XValues.Count > 0) { this.lowPoints = GetPointsFromValues(XValues, YValues); } XValues = this.GetReflectionValues(this.XPath, PointsSource, XValues, false); YValues = this.GetReflectionValues(this.HighPath, PointsSource, YValues, false); if (XValues != null && XValues.Count > 0) { this.Points = GetPointsFromValues(XValues, YValues); } HighValues = YValues; }