0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

cscの作法 その39

Last updated at Posted at 2020-01-23

概要

cscの作法、調べてみた。
chartやってみた。

環境

.NETFramework4.8

写真

image.png

コンパイル

csc chart1.cs /r:System.Windows.Forms.DataVisualization.dll

サンプルコード

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Windows.Forms.DataVisualization.Charting;

namespace myapp 
{
	class ChartSample1 {
		public partial class form1: Form {
			private Chart chart;
			public form1() {
				this.Size = new Size(400, 400);
				this.Load += new System.EventHandler(this.form1_Load);
			}
			private void form1_Load(object sender, EventArgs e) {
				this.chart = new Chart();
				chart.ChartAreas.Clear();
				chart.Titles.Clear();
				chart.Series.Clear();
				ChartArea area = new ChartArea("area1");
				Title title = new Title("title1");
				title.DockedToChartArea = "area1";
				Series series1 = new Series();
				Series series2 = new Series();
				series1.ChartType = SeriesChartType.Line;
				series2.ChartType = SeriesChartType.Line;
				for (int i = 0; i < 360; i++)
				{
					series1.Points.AddXY(i, Math.Sin(i * Math.PI / 180.0));
					series2.Points.AddXY(i, Math.Cos(i * Math.PI / 180.0));
				}
				series1.ChartArea = "area1";
				series2.ChartArea = "area1";
				chart.ChartAreas.Add(area);
				chart.Titles.Add(title);
				chart.Series.Add(series1);
				chart.Series.Add(series2);
				this.Controls.Add(this.chart);
			}
		}
		static void Main() {
			Application.Run(new form1());
		}
	}
}




以上。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?