예제 #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);
		}
예제 #2
0
 internal void Initialize(BasicChart owner)
 {
     chart = owner;
 }
예제 #3
0
		public InstrumenationChartView (InstrumentationViewerDialog parent)
		{
			Build ();
			
			this.parent = parent;
			
			// The list for the List Mode
			
			listViewStore = new ListStore (typeof(ListViewValueInfo), typeof(Gdk.Pixbuf), typeof (string), typeof(string), typeof(string), typeof (string), typeof (string));
			listView = new TreeView ();
			listView.Model = listViewStore;
			
			CellRendererText crx = new CellRendererText ();
			listView.AppendColumn ("Timestamp", crx, "text", 3);
			
			TreeViewColumn col = new TreeViewColumn ();
			col.Title = "Counter";
			CellRendererPixbuf crp = new CellRendererPixbuf ();
			col.PackStart (crp, false);
			col.AddAttribute (crp, "pixbuf", 1);
			col.PackStart (crx, true);
			col.AddAttribute (crx, "text", 2);
			listView.AppendColumn (col);
			
			listView.AppendColumn ("Count", crx, "text", 4);
			listView.AppendColumn ("Total Count", crx, "text", 5);
			listView.AppendColumn ("Time", crx, "text", 6);
			
			listView.RowActivated += HandleListViewRowActivated;
			
			listViewScrolled = new ScrolledWindow ();
			listViewScrolled.Add (listView);
			listViewScrolled.ShadowType = ShadowType.In;
			listViewScrolled.HscrollbarPolicy = PolicyType.Automatic;
			listViewScrolled.VscrollbarPolicy = PolicyType.Automatic;
			listViewScrolled.ShowAll ();
			boxCharts.PackStart (listViewScrolled, true, true, 0);
			
			// The series list
			
			seriesStore = new ListStore (typeof(bool), typeof(Gdk.Pixbuf), typeof (string), typeof(ChartSerieInfo), typeof(String), typeof(String), typeof (String));
			listSeries.Model = seriesStore;
			
			col = new TreeViewColumn ();
			col.Title = "Counter";
			CellRendererToggle crt = new CellRendererToggle ();
			col.PackStart (crt, false);
			col.AddAttribute (crt, "active", 0);
			
			crp = new CellRendererPixbuf ();
			col.PackStart (crp, false);
			col.AddAttribute (crp, "pixbuf", 1);
			
			crx = new CellRendererText ();
			col.PackStart (crx, true);
			col.AddAttribute (crx, "text", 2);
			listSeries.AppendColumn (col);
			
			listSeries.AppendColumn ("Last", crx, "text", 4);
			listSeries.AppendColumn ("Sel", crx, "text", 5);
			listSeries.AppendColumn ("Diff", crx, "text", 6);
			
			crt.Toggled += SerieToggled;
			
			countChart = new BasicChart ();
			countAxisY = new IntegerAxis (true);
			countAxisX = new DateTimeAxis (true);
			countChart.AddAxis (countAxisX, AxisPosition.Bottom);
			countChart.AddAxis (countAxisY, AxisPosition.Right);
			countChart.OriginY = 0;
			countChart.StartY = 0;
//			countChart.EndY = 100;
			countChart.AllowSelection = true;
			countChart.SetAutoScale (AxisDimension.Y, false, true);
			countChart.SelectionStart.LabelAxis = countAxisX;
			countChart.SelectionEnd.LabelAxis = countAxisX;
			countChart.SelectionChanged += CountChartSelectionChanged;
			
			timeChart = new BasicChart ();
			timeAxisY = new IntegerAxis (true);
			timeAxisX = new DateTimeAxis (true);
			timeChart.AddAxis (timeAxisX, AxisPosition.Bottom);
			timeChart.AddAxis (timeAxisY, AxisPosition.Right);
			timeChart.OriginY = 0;
			timeChart.StartY = 0;
			timeChart.EndY = 100;
			timeChart.AllowSelection = true;
//			timeChart.SetAutoScale (AxisDimension.Y, true, true);
			timeChart.SelectionStart.LabelAxis = timeAxisX;
			timeChart.SelectionEnd.LabelAxis = timeAxisX;
			
			frameCharts.PackStart (countChart, true, true, 0);
			frameCharts.PackStart (timeChart, true, true, 0);
			frameCharts.ShowAll ();
			
			if (App.FromFile) {
				if (visibleTime > App.Service.EndTime - App.Service.StartTime)
					visibleTime = App.Service.EndTime - App.Service.StartTime;
				startTime = App.Service.StartTime;
				endTime = startTime + visibleTime;
			}
			else {
				endTime = DateTime.Now;
				startTime = endTime - visibleTime;
			}
			
			DateTime st = App.Service.StartTime;
			if (st > startTime) st = startTime;
			
			chartScroller.Adjustment.Lower = st.Ticks;
			
			UpdateCharts ();
			chartScroller.Value = chartScroller.Adjustment.Upper;
			
			if (!App.FromFile)
				StartAutoscroll ();
			
			toggleTimeView.Active = true;
		}
예제 #4
0
		internal void Initialize (BasicChart owner)
		{
			chart = owner;
		}