Exemple #1
0
 internal ChartStyle(Chart2D ct2d)
 {
     chart2d        = ct2d;
     chartArea      = new Rectangle(new Point(0, 0), chart2d.ChartSize);
     chartAreaColor = new GraphColor(Color.White, Color.White);
     plotAreaColor  = new GraphColor();
     XOffset        = ChartArea.Width / 30.0f;
     YOffset        = ChartArea.Height / 30.0f;
 }
Exemple #2
0
        public Chart2D Clone()
        {
            Chart2D newChart = new Chart2D(this.ChartSize);

            newChart.ChartStyle = this.ChartStyle.Clone();
            newChart.XAxis      = this.XAxis.Clone();
            newChart.YAxis      = this.YAxis.Clone();
            newChart.Y2Axis     = this.Y2Axis.Clone();
            newChart.RAxis      = this.RAxis.Clone();
            newChart.Grid       = this.Grid.Clone();
            newChart.Legend     = this.Legend.Clone();
            newChart.Title      = this.Title.Clone();
            newChart.Label      = this.Label.Clone();

            return(newChart);
        }
Exemple #3
0
        /// <summary>
        /// 将一个Chart2D添加到指定位置,并返回当前所含Chart2D数组绘制的Bitmap
        /// </summary>
        /// <param name="chart"></param>
        /// <param name="rowNum"></param>
        /// <param name="colNum"></param>
        /// <returns></returns>
        public Bitmap AddSubChart(Chart2D chart, int rowNum, int colNum)
        {
            if (rowNum >= rows || colNum >= cols)
            {
                return(null);
            }
            else
            {
                subCharts[rowNum, colNum] = chart;
            }

            Bitmap   bmp = new Bitmap(totalChartArea.Width, totalChartArea.Height);
            Graphics g   = Graphics.FromImage(bmp);
            // Draw total chart area:
            Pen        aPen   = new Pen(TotalChartColor.Border, 1f);
            SolidBrush aBrush = new SolidBrush(TotalChartColor.Fill);

            g.FillRectangle(aBrush, TotalChartArea);
            g.DrawRectangle(aPen, TotalChartArea);
            aPen.Dispose();
            aBrush.Dispose();

            for (int i = 0; i < rows; i++)
            {
                for (int j = 0; j < cols; j++)
                {
                    if (subCharts[i, j] != null)
                    {
                        Bitmap chartbmp = subCharts[i, j].AddChart();
                        g.DrawImage(chartbmp, subRectangles[i, j], chart.ChartStyle.ChartArea, GraphicsUnit.Pixel);
                    }
                }
            }
            g.Dispose();
            return(bmp);
        }