Пример #1
0
    public static LineItem AddPoints(this GraphPane myPane, PointPairList ppl, Color color, string title = "")
    {
      if (ppl.Count > 0)
      {
        LineItem curve = myPane.AddCurve(title, ppl, color, SymbolType.Diamond);
        curve.Symbol.Size = 8;
        curve.Symbol.Fill = new Fill(color);
        curve.Symbol.Border.IsVisible = false;
        curve.Line.IsVisible = false;
        return curve;
      }

      return null;
    }
Пример #2
0
    public static LineItem AddPoints(this GraphPane myPane, PointPairList ppl, Color color, Color[] colors, string title = "")
    {
      if (ppl.Count > 0)
      {
        LineItem curve = myPane.AddCurve(title, ppl, color, SymbolType.Diamond);
        curve.Symbol.Size = 8;
        curve.Symbol.Fill = new Fill(colors)
        {
          Type = FillType.GradientByColorValue,
          RangeMin = 0,
          RangeMax = colors.Length - 1,
          SecondaryValueGradientColor = Color.Black
        };
        curve.Symbol.Border.IsVisible = false;
        curve.Line.IsVisible = false;
        return curve;
      }

      return null;
    }
Пример #3
0
		/// <summary>
		/// Adds a curve that intersects with the specified <paramref name="points"/> to the path with the given <paramref name="tension"/>
		/// </summary>
		/// <param name="path">Path to add the curve to</param>
		/// <param name="tension">Tension between points in the curve.  Should be between 0 (no curve) and 1 (more curve)</param>
		/// <param name="points">Points that intersect with the curve</param>
		public static void AddCurve (this IGraphicsPath path, float tension, params PointF[] points)
		{
			path.AddCurve (points, tension);
		}
Пример #4
0
		/// <summary>
		/// Adds a curve that intersects with the specified <paramref name="points"/> to the path
		/// </summary>
		/// <param name="path">Path to add the curve to</param>
		/// <param name="points">Points that define where the curve intersects</param>
		public static void AddCurve (this IGraphicsPath path, params PointF[] points)
		{
			path.AddCurve (points);
		}
Пример #5
0
    public static void DrawProbabilityRange(this GraphPane panel, double maxX, List<double> ratios)
    {
      var skipCount = ratios.Count / 20;

      var keptRatios = ratios.Skip(skipCount).ToList().Take(ratios.Count - 2 * skipCount).ToList();

      if (keptRatios.Count > 1)
      {
        var mean = Statistics.Mean(keptRatios);
        var sd = Statistics.StandardDeviation(keptRatios);

        var nd = new Normal(mean, sd);

        PointPairList pplMean = new PointPairList();
        pplMean.Add(new PointPair(0, mean));
        pplMean.Add(new PointPair(maxX, mean));
        LineItem meanLine = panel.AddCurve(MyConvert.Format("Mean={0:0.0000}, Sigma={1:0.0000}", mean, sd), pplMean, Color.Red, SymbolType.None);
        meanLine.Line.IsVisible = true;

        var prob90range = nd.GetProb90Range();

        PointPairList pplMin90 = new PointPairList();
        pplMin90.Add(new PointPair(0, prob90range.First));
        pplMin90.Add(new PointPair(maxX, prob90range.First));
        LineItem min95Line = panel.AddCurve("90% Confidence", pplMin90, Color.Brown, SymbolType.None);
        min95Line.Line.IsVisible = true;

        PointPairList pplMax90 = new PointPairList();
        pplMax90.Add(new PointPair(0, prob90range.Second));
        pplMax90.Add(new PointPair(maxX, prob90range.Second));
        LineItem max95Line = panel.AddCurve("", pplMax90, Color.Brown, SymbolType.None);
        max95Line.Line.IsVisible = true;
      }
    }
Пример #6
0
    public static void AddIndividualLine(this GraphPane myPane, String title, PointPairList list, Color? defaultColor = null, Color? tagColor = null, int tagFontSize = 10, DashStyle dStyle = DashStyle.Solid)
    {
      int index = 0;

      Color defaultLineColor = defaultColor.HasValue ? defaultColor.Value : Color.Black;
      Color defaultTagColor = tagColor.HasValue ? tagColor.Value : Color.Green;

      list.ForEach(pt =>
      {
        var ppl = new PointPairList();
        ppl.Add(new PointPair(pt.X, 0));
        ppl.Add(pt);

        Color curColor = pt.Tag == null ? defaultLineColor : defaultTagColor;
        LineItem line;
        if (index == 0)
        {
          line = myPane.AddCurve(title, ppl, curColor, SymbolType.None);
          index++;
        }
        else
        {
          line = myPane.AddCurve("", ppl, curColor, SymbolType.None);
        }
        line.Line.Style = dStyle;

        if (pt.Tag != null)
        {
          TextObj text = new TextObj(pt.Tag.ToString(), pt.X, pt.Y, CoordType.AxisXYScale, AlignH.Left, AlignV.Center);

          text.ZOrder = ZOrder.A_InFront;
          // Hide the border and the fill
          text.FontSpec.Border.IsVisible = false;
          text.FontSpec.Fill.IsVisible = false;
          text.FontSpec.Angle = 90;  //字体倾斜度
          text.FontSpec.Size = tagFontSize;
          text.FontSpec.FontColor = curColor;
          myPane.GraphObjList.Add(text);
        }
      });
    }