Exemple #1
0
        private void InitGraph(
            string title, string xAxisTitle,
            string y1AxisTitle, string y2AxisTitle,
            SummaryDataSource[] dataSourceArray)
        {
            _graphPane            = zed.GraphPane;
            _graphPane.Title.Text = title;

            _graphPane.XAxis.Title.Text          = xAxisTitle;
            _graphPane.XAxis.MajorGrid.IsVisible = true;

            _graphPane.YAxis.Title.Text          = y1AxisTitle;
            _graphPane.YAxis.MajorGrid.IsVisible = true;

            _graphPane.Y2Axis.Title.Text          = y2AxisTitle;
            _graphPane.Y2Axis.MajorGrid.IsVisible = false;

            // Create point-pair lists and bind them to the graph control.
            int sourceCount = dataSourceArray.Length;

            _pointPlotArray = new PointPairList[sourceCount];

            for (int i = 0; i < sourceCount; i++)
            {
                SummaryDataSource ds = dataSourceArray[i];
                _pointPlotArray[i] = new PointPairList();

                Color   color   = _plotColorArr[i % 3];
                BarItem barItem = _graphPane.AddBar(ds.Name, _pointPlotArray[i], color);
                barItem.Bar.Fill = new Fill(color);
                _graphPane.BarSettings.MinClusterGap = 0;

                barItem.IsY2Axis = (ds.YAxis == 1);
            }
        }
Exemple #2
0
        /// <summary>
        /// Refresh view.
        /// </summary>
        public void RefreshView()
        {
            if (this.InvokeRequired)
            {
                // Note. Must use Invoke(). BeginInvoke() will execute asynchronously and the evolution algorithm therefore
                // may have moved on and will be in an intermediate and indeterminate (between generations) state.
                this.Invoke(new MethodInvoker(delegate()
                {
                    RefreshView();
                }));
                return;
            }

            if (this.IsDisposed)
            {
                return;
            }

            // Update plot points for each series in turn.
            int sourceCount = _dataSourceArray.Length;

            for (int i = 0; i < sourceCount; i++)
            {
                SummaryDataSource ds       = _dataSourceArray[i];
                Point2DDouble[]   pointArr = ds.GetPointArray();
                PointPairList     ppl      = _pointPlotArray[i];
                EnsurePointPairListLength(ppl, pointArr.Length);

                for (int j = 0; j < pointArr.Length; j++)
                {
                    ppl[j].X = pointArr[j].X;
                    ppl[j].Y = pointArr[j].Y;
                }
            }

            // Trigger graph to redraw.
            zed.AxisChange();
            Refresh();
        }