예제 #1
0
    public static GraphicsPath GetPath(XYPlotScatterStyles.Shape sh, XYPlotScatterStyles.Style st, float size)
    {
      float sizeh = size / 2;
      GraphicsPath gp = new GraphicsPath();


      switch (sh)
      {
        case XYPlotScatterStyles.Shape.Square:
          gp.AddRectangle(new RectangleF(-sizeh, -sizeh, size, size));
          gp.StartFigure();
          break;
        case XYPlotScatterStyles.Shape.Circle:
          gp.AddEllipse(-sizeh, -sizeh, size, size);
          gp.StartFigure();
          break;
        case XYPlotScatterStyles.Shape.UpTriangle:
          gp.AddLine(0, -sizeh, 0.3301270189f * size, 0.5f * sizeh);
          gp.AddLine(0.43301270189f * size, 0.5f * sizeh, -0.43301270189f * size, 0.5f * sizeh);
          gp.CloseFigure();
          break;
        case XYPlotScatterStyles.Shape.DownTriangle:
          gp.AddLine(-0.43301270189f * sizeh, -0.5f * sizeh, 0.43301270189f * size, -0.5f * sizeh);
          gp.AddLine(0.43301270189f * size, -0.5f * sizeh, 0, sizeh);
          gp.CloseFigure();
          break;
        case XYPlotScatterStyles.Shape.Diamond:
          gp.AddLine(0, -sizeh, sizeh, 0);
          gp.AddLine(sizeh, 0, 0, sizeh);
          gp.AddLine(0, sizeh, -sizeh, 0);
          gp.CloseFigure();
          break;
        case XYPlotScatterStyles.Shape.CrossPlus:
          gp.AddLine(-sizeh, 0, sizeh, 0);
          gp.StartFigure();
          gp.AddLine(0, sizeh, 0, -sizeh);
          gp.StartFigure();
          break;
        case XYPlotScatterStyles.Shape.CrossTimes:
          gp.AddLine(-sizeh, -sizeh, sizeh, sizeh);
          gp.StartFigure();
          gp.AddLine(-sizeh, sizeh, sizeh, -sizeh);
          gp.StartFigure();
          break;
        case XYPlotScatterStyles.Shape.Star:
          gp.AddLine(-sizeh, 0, sizeh, 0);
          gp.StartFigure();
          gp.AddLine(0, sizeh, 0, -sizeh);
          gp.StartFigure();
          gp.AddLine(-sizeh, -sizeh, sizeh, sizeh);
          gp.StartFigure();
          gp.AddLine(-sizeh, sizeh, sizeh, -sizeh);
          gp.StartFigure();
          break;
        case XYPlotScatterStyles.Shape.BarHorz:
          gp.AddLine(-sizeh, 0, sizeh, 0);
          gp.StartFigure();
          break;
        case XYPlotScatterStyles.Shape.BarVert:
          gp.AddLine(0, -sizeh, 0, sizeh);
          gp.StartFigure();
          break;
      }

      switch (st)
      {
        case XYPlotScatterStyles.Style.DotCenter:
          gp.AddEllipse(-0.125f * sizeh, -0.125f * sizeh, 0.125f * size, 0.125f * size);
          gp.StartFigure();
          break;
        case XYPlotScatterStyles.Style.Plus:
          gp.AddLine(-sizeh, 0, sizeh, 0);
          gp.StartFigure();
          gp.AddLine(0, sizeh, 0, -sizeh);
          gp.StartFigure();
          break;
        case XYPlotScatterStyles.Style.Times:
          gp.AddLine(-sizeh, -sizeh, sizeh, sizeh);
          gp.StartFigure();
          gp.AddLine(-sizeh, sizeh, sizeh, -sizeh);
          gp.StartFigure();
          break;
        case XYPlotScatterStyles.Style.BarHorz:
          gp.AddLine(-sizeh, 0, sizeh, 0);
          gp.StartFigure();
          break;
        case XYPlotScatterStyles.Style.BarVert:
          gp.AddLine(0, -sizeh, 0, sizeh);
          gp.StartFigure();
          break;
      }
      return gp;
    }
예제 #2
0
    public ScatterPlotStyle(XYPlotScatterStyles.Shape shape, XYPlotScatterStyles.Style style, float size, float penWidth, Color penColor)
    {
      _shape = shape;
      _style = style;
      _dropLine = new CSPlaneIDList();
      _pen = new PenX(penColor, penWidth);
      _symbolSize = size;

      _relativePenWidth = penWidth / size;
      _skipFreq = 1;

      // Cached values
      SetCachedValues();
      CreateEventChain();
    }