예제 #1
0
        private void AddChart()
        {
            chartCanvas.Children.Clear();
            cs                 = new ChartStyle2D();
            cs.ChartCanvas     = this.chartCanvas;
            cs.GridlinePattern = ChartStyle.GridlinePatternEnum.Solid;
            cs.IsColorBar      = true;
            cs.Title           = "No Title";
            ds                 = new DataSeriesSurface();
            Utility.Peak3D(cs, ds);

            d3c = new Draw3DChart();
            d3c.Colormap.ColormapBrushType = ColormapBrush.ColormapBrushEnum.Jet;
            d3c.ChartType        = Draw3DChart.ChartTypeEnum.MeshContour3D;
            d3c.IsLineColorMatch = true;
            d3c.NumberContours   = 15;
            d3c.AddChart(cs, ds);
        }
 private void AddChart()
 {
     chartCanvas.Children.Clear();
     cs                 = new ChartStyle2D();
     cs.ChartCanvas     = this.chartCanvas;
     cs.GridlinePattern = ChartStyle.GridlinePatternEnum.Solid;
     cs.Elevation       = 30;
     cs.Azimuth         = -37;
     cs.Title           = "No Title";
     cs.IsColorBar      = true;
     ds                 = new DataSeriesSurface();
     ds.LineColor       = Brushes.Transparent;
     Utility.Peak3D(cs, ds);
     d3c           = new Draw3DChart();
     d3c.ChartType = Draw3DChart.ChartTypeEnum.XYColor;
     cs.AddChartStyle2D(d3c);
     d3c.IsInterp     = true;
     d3c.NumberInterp = 5;
     d3c.AddChart(cs, ds);
 }
예제 #3
0
        private void AddChart()
        {
            chartCanvas.Children.Clear();
            cs                 = new ChartStyle2D();
            cs.ChartCanvas     = this.chartCanvas;
            cs.GridlinePattern = ChartStyle.GridlinePatternEnum.Solid;
            cs.IsColorBar      = true;
            cs.Title           = "No Title";
            ds                 = new Bar3DStyle();
            ds.LineColor       = Brushes.Black;
            ds.ZOrigin         = 0;
            ds.XLength         = 0.6;
            ds.YLength         = 0.6;
            Utility.Peak3D(cs, ds);

            d3c = new Draw3DChart();
            d3c.Colormap.ColormapBrushType = ColormapBrush.ColormapBrushEnum.Jet;
            d3c.IsBarSingleColor           = true;
            d3c.IsColormap = true;

            cs.AddChartStyle();
            d3c.AddBar3D(cs, ds);
        }
        public void AddColorBar2D(ChartStyle2D cs, DataSeriesSurface ds, Draw3DChart dsc, double zmin, double zmax)
        {
            TextBlock tb;

            tb            = new TextBlock();
            tb.Text       = "A";
            tb.FontFamily = cs.TickFont;
            tb.FontSize   = cs.TickFontSize;
            tb.Measure(new Size(Double.PositiveInfinity, Double.PositiveInfinity));
            Size tickSize = tb.DesiredSize;

            double x      = 8 * cs.ChartCanvas.Width / 9;
            double y      = 7;
            double width  = cs.ChartCanvas.Width / 25;
            double height = chart2dCanvas.Height;

            Point3D[] pts = new Point3D[64];
            double    dz  = (zmax - zmin) / 63;

            // Create the color bar:
            Polygon plg;

            for (int i = 0; i < 64; i++)
            {
                pts[i] = new Point3D(x, y, zmin + i * dz);
            }
            for (int i = 0; i < 63; i++)
            {
                SolidColorBrush brush = dsc.GetBrush(pts[i].Z, zmin, zmax);
                double          y1    = y + height - (pts[i].Z - zmin) * height / (zmax - zmin);
                double          y2    = y + height - (pts[i + 1].Z - zmin) * height / (zmax - zmin);
                plg = new Polygon();
                plg.Points.Add(new Point(x, y2));
                plg.Points.Add(new Point(x + width, y2));
                plg.Points.Add(new Point(x + width, y1));
                plg.Points.Add(new Point(x, y1));
                plg.Fill   = brush;
                plg.Stroke = brush;
                cs.ChartCanvas.Children.Add(plg);
            }
            Rectangle rect = new Rectangle();

            rect.Width  = width + 2;
            rect.Height = height + 2;
            rect.Stroke = Brushes.Black;
            Canvas.SetLeft(rect, x - 1);
            Canvas.SetTop(rect, y - 1);
            cs.ChartCanvas.Children.Add(rect);

            // Add ticks and labels to the color bar:
            double tickLength = 0.15 * width;

            for (double z = zmin; z <= zmax; z = z + (zmax - zmin) / 6)
            {
                double yy = y + height - (z - zmin) * height / (zmax - zmin);
                dsc.AddTickLine(cs, new Point(x, yy), new Point(x + tickLength, yy));
                dsc.AddTickLine(cs, new Point(x + width, yy), new Point(x + width - tickLength, yy));
                tb            = new TextBlock();
                tb.Text       = (Math.Round(z, 2)).ToString();
                tb.FontFamily = cs.TickFont;
                tb.FontSize   = cs.TickFontSize;
                cs.ChartCanvas.Children.Add(tb);
                Canvas.SetLeft(tb, x + width + 5);
                Canvas.SetTop(tb, yy - tickSize.Height / 2);
            }
        }