private void OnLoaded(object sender, RoutedEventArgs e)
        {
            foreach (var plotter in GetPlottersToUpdateAxis())
            {
                var axis = new IntegerAxis {
                    LabelProvider = new CollectionLabelProvider <char>(chars)
                };
                plotter.MainHorizontalAxis = axis;
            }

            inputTb.Text = "Sample text";

            var hAxis = (NumericAxis)plotter3.MainHorizontalAxis;

            hAxis.LabelProvider.CustomFormatter = d => ((char)d.Tick).ToString();
        }
		private void OnLoaded(object sender, RoutedEventArgs e)
		{
			foreach (var plotter in GetPlottersToUpdateAxis())
			{
				var axis = new IntegerAxis { LabelProvider = new CollectionLabelProvider<char>(chars) };
				plotter.MainHorizontalAxis = axis;
			}

			inputTb.Text = "Sample text";

			var hAxis = (NumericAxis)plotter3.MainHorizontalAxis;
			hAxis.LabelProvider.CustomFormatter = d => ((char)d.Tick).ToString();
		}
Exemple #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;
        }