コード例 #1
0
        private void AddChart1()
        {
            var cs = new ChartStylePolar();
            var dc = new DataCollectionPolar();
            cs.ChartCanvas = chartCanvas;
            cs.Rmin = -7.0;
            cs.Rmax = 3.0;
            cs.NTicks = 4;
            cs.AngleStep = 15;
            cs.AngleOffset = -90;
            cs.AngleDirection = ChartStylePolar.AngleDirectionEnum.ClockWise;
            cs.LinePattern = ChartStylePolar.LinePatternEnum.Dot;
            cs.LineColor = Brushes.Black;
            cs.SetPolarAxes();

            var ds1 = new DataSeries();
            ds1.LineColor = Brushes.Red;
            for (int i = 0; i < 360; i++)
            {
                double theta = 1.0 * i;
                double r = Math.Log(1.001 + Math.Sin(2 * theta * Math.PI / 180));
                ds1.LineSeries.Points.Add(new Point(theta, r));
            }
            dc.DataList.Add(ds1);

            var ds2 = new DataSeries();
            ds2.LineColor = Brushes.Blue;
            for (int i = 0; i < 360; i++)
            {
                double theta = 1.0 * i;
                double r = Math.Log(1.001 + Math.Cos(2 * theta * Math.PI / 180));
                ds2.LineSeries.Points.Add(new Point(theta, r));
            }
            //dc.DataList.Add(ds2);

            var ds3 = new DataSeries();
            ds3.LineColor = Brushes.Green;
            //ds3.LineSeries.SetValue(RenderOptions.EdgeModeProperty, EdgeMode.Unspecified);
            ds3.LineSeries.Points.Add(new Point(0, -7));
            var fill = new SolidColorBrush(Colors.Red);
            fill.Opacity = .5;
            ds3.LineSeries.Fill = fill;
            //ds3.LineSeries.Points.Add(new Point(-15, 1));

            for (int i = -15; i <= 15; i++)
            {
                double theta = 1.0 * i;
                //double r = Math.Log(1.001 + Math.Cos(2 * theta * Math.PI / 180));
                ds3.LineSeries.Points.Add(new Point(theta, 1));
            }
            //ds3.LineSeries.Points.Add(new Point(15, 1));
            ds3.LineSeries.Points.Add(new Point(0, -7));
            dc.DataList.Add(ds3);

            dc.AddPolar(cs);
        }
コード例 #2
0
ファイル: MainWindow.xaml.cs プロジェクト: gzt200361/offwind
        private void AddChart1()
        {
            var cs = new ChartStylePolar();
            var dc = new DataCollectionPolar();

            cs.ChartCanvas    = chartCanvas;
            cs.Rmin           = -7.0;
            cs.Rmax           = 3.0;
            cs.NTicks         = 4;
            cs.AngleStep      = 15;
            cs.AngleOffset    = -90;
            cs.AngleDirection = ChartStylePolar.AngleDirectionEnum.ClockWise;
            cs.LinePattern    = ChartStylePolar.LinePatternEnum.Dot;
            cs.LineColor      = Brushes.Black;
            cs.SetPolarAxes();

            var ds1 = new DataSeries();

            ds1.LineColor = Brushes.Red;
            for (int i = 0; i < 360; i++)
            {
                double theta = 1.0 * i;
                double r     = Math.Log(1.001 + Math.Sin(2 * theta * Math.PI / 180));
                ds1.LineSeries.Points.Add(new Point(theta, r));
            }
            dc.DataList.Add(ds1);

            var ds2 = new DataSeries();

            ds2.LineColor = Brushes.Blue;
            for (int i = 0; i < 360; i++)
            {
                double theta = 1.0 * i;
                double r     = Math.Log(1.001 + Math.Cos(2 * theta * Math.PI / 180));
                ds2.LineSeries.Points.Add(new Point(theta, r));
            }
            //dc.DataList.Add(ds2);

            var ds3 = new DataSeries();

            ds3.LineColor = Brushes.Green;
            //ds3.LineSeries.SetValue(RenderOptions.EdgeModeProperty, EdgeMode.Unspecified);
            ds3.LineSeries.Points.Add(new Point(0, -7));
            var fill = new SolidColorBrush(Colors.Red);

            fill.Opacity        = .5;
            ds3.LineSeries.Fill = fill;
            //ds3.LineSeries.Points.Add(new Point(-15, 1));

            for (int i = -15; i <= 15; i++)
            {
                double theta = 1.0 * i;
                //double r = Math.Log(1.001 + Math.Cos(2 * theta * Math.PI / 180));
                ds3.LineSeries.Points.Add(new Point(theta, 1));
            }
            //ds3.LineSeries.Points.Add(new Point(15, 1));
            ds3.LineSeries.Points.Add(new Point(0, -7));
            dc.DataList.Add(ds3);

            dc.AddPolar(cs);
        }