示例#1
0
文件: ChartSample.cs 项目: m13253/xwt
		public ChartSample ()
		{
			BasicChart chart = new BasicChart ();
			chart.AllowSelection = true;
			chart.AddAxis (new IntegerAxis (true), AxisPosition.Left);
			chart.AddAxis (new IntegerAxis (true), AxisPosition.Bottom);
			
			Serie s = new Serie ("Some Data");
			s.Color = new Color (0,1,0);
			s.AddData (10, 10);
			s.AddData (20, 11);
			s.AddData (30, 15);
			s.AddData (40, 9);
			chart.AddSerie (s);
			s = new Serie ("Other Data");
			s.Color = new Color (0,0,1);
			s.AddData (10, 20);
			s.AddData (20, 19);
			s.AddData (30, 25);
			s.AddData (40, 26);
			chart.AddSerie (s);
			chart.SetAutoScale (AxisDimension.X, true, true);
			chart.SetAutoScale (AxisDimension.Y, true, true);
			
			PackStart (chart, true);
		}
		public void CopyFrom (ChartSerieInfo other)
		{
			Name = other.Name;
			Visible = other.Visible;
			serie = other.serie;
			counter = other.counter;
		}
示例#3
0
        void DrawSerie(Cairo.Context ctx, Serie serie)
        {
            ctx.NewPath ();
            ctx.Rectangle (left, top, width + 1, height + 1);
            ctx.Clip ();

            ctx.NewPath ();
            ctx.SetSourceColor (serie.Color);
            ctx.LineWidth = serie.LineWidth;

            bool first = true;
            bool blockMode = serie.DisplayMode == DisplayMode.BlockLine;

            double lastY = 0;

            foreach (Data d in serie.GetData (startX, endX)) {
                double x, y;
                GetPoint (d.X, d.Y, out x, out y);
                if (first) {
                    ctx.MoveTo (x, y);
                    lastY = y;
                    first = false;
                } else {
                    if (blockMode) {
                        if (lastY != y)
                            ctx.LineTo (x, lastY);
                        ctx.LineTo (x, y);
                    } else
                        ctx.LineTo (x, y);
                }
                lastY = y;
            }

            ctx.Stroke ();
        }
示例#4
0
 public void RemoveSerie(Serie serie)
 {
     series.Remove (serie);
     serie.Owner = null;
     OnSerieChanged ();
 }
示例#5
0
 public void AddSerie(Serie serie)
 {
     serie.Owner = this;
     series.Add (serie);
     OnSerieChanged ();
 }
示例#6
0
		public TestChart ()
		{
			AllowSelection = true;
			SetAutoScale (AxisDimension.Y, false, true);
			StartY = 0;
			
			serieFailed = new Serie (GettextCatalog.GetString("Failed tests"));
			serieFailed.Color = new Cairo.Color (1, 0, 0);
			serieSuccess = new Serie (GettextCatalog.GetString("Successful tests"));
			serieSuccess.Color = new Cairo.Color (0, 0.65, 0);
			serieIgnored = new Serie (GettextCatalog.GetString("Ignored tests"));
			serieIgnored.Color = new Cairo.Color (0.8, 0.8, 0);
			
			serieTime = new Serie (GettextCatalog.GetString("Time"));
			serieTime.Color = new Cairo.Color (0, 0, 1);
			
			UpdateMode ();
			
/*			EndX = DateTime.Now.Ticks;
			StartX = EndX - currentSpan.Ticks;
			*/
			EndX = 5;
			StartX = 0;
		}
示例#7
0
 public void RemoveSerie(Serie serie)
 {
     series.Remove(serie);
     serie.Owner = null;
     OnSerieChanged();
 }
示例#8
0
 public void AddSerie(Serie serie)
 {
     serie.Owner = this;
     series.Add(serie);
     OnSerieChanged();
 }
示例#9
0
 public void RemoveSerie(Serie serie)
 {
     widget.RemoveSerie(serie);
 }
示例#10
0
 public void AddSerie(Serie serie)
 {
     widget.AddSerie(serie);
 }
示例#11
0
		public void RemoveSerie (Serie serie)
		{
			widget.RemoveSerie (serie);
		}
示例#12
0
		public void AddSerie (Serie serie)
		{
			widget.AddSerie (serie);
		}
		public bool UpdateCounter ()
		{
			if (!Counter.Disposed)
				return false;
			serie = null;
			counter = null;
			lastUpdateTime = DateTime.MinValue;
			return true;
		}