1
1

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の作法 その463

Last updated at Posted at 2024-03-04

概要

cscの作法、調べてみた。
練習問題やってみた。

練習問題

Chartで、sin波を表示せよ。

写真

image.png

サンプルコード


using System;
using System.Windows.Forms;
using System.Drawing;
using System.Windows.Forms.DataVisualization.Charting;

namespace App
{
	public partial class Form1: Form {
		public Form1() {
			this.Size = new Size(600, 400);
			this.Text = "sin";
			Chart chart1 = new Chart();
			chart1.ChartAreas.Clear();
			chart1.Series.Clear();
			chart1.Legends.Clear();
			chart1.Dock = DockStyle.Fill;
			chart1.ChartAreas.Add(new ChartArea());
			ChartArea chartArea = chart1.ChartAreas[0];
			chartArea.AxisX.IsMarginVisible = false;
			chartArea.AxisY.IsMarginVisible = false;
			chartArea.CursorX.IsUserSelectionEnabled = true;
			chartArea.CursorY.IsUserSelectionEnabled = true;
			chartArea.CursorX.Interval = 0;
			chartArea.CursorY.Interval = 0;
			chartArea.InnerPlotPosition.Auto = false;
			chartArea.InnerPlotPosition.X = 8.0f;
			chartArea.InnerPlotPosition.Y = 4.0f;
			chartArea.InnerPlotPosition.Width = 84.0f;
			chartArea.InnerPlotPosition.Height = 84.0f;
			this.Controls.Add(chart1);
			Series series = new Series {
				Color = Color.Blue,
				MarkerColor = Color.Blue,
				MarkerSize = 7,
				MarkerStyle = MarkerStyle.Circle,
				ChartType = SeriesChartType.Line
			};
			for (double i = 0; i < 720; i++)
			{
				double v = Math.Sin(i / 360 * 3.14 * 2);
				series.Points.AddXY(i, v);
			}
			chart1.Series.Add(series);
		}
		static void Main() {
			Application.Run(new Form1());
		}
	}
}





以上。

1
1
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
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?