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

cscの作法 その465

Posted at

概要

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

練習問題

式を評価して、グラフ化せよ。

写真

image.png

サンプルコード

using System;
using System.Windows.Forms;
using System.Drawing;
using System.Windows.Forms.DataVisualization.Charting;
using ClosedXML.Excel;
using System.Data;

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
			};
			var wb = new XLWorkbook();
			var ws = wb.Worksheets.Add("Formulas");
			for (double i = 0; i < 720; i++)
			{
				string formula = string.Format("SIN({0} / 360 * PI() * 2)", i);
				ws.Cell(1, 1).FormulaA1 = formula;
				var v = ws.Cell(1, 1).Value;
				series.Points.AddXY(i, v);
			}
			chart1.Series.Add(series);
		}
		static void Main() {
			Application.Run(new Form1());
		}
	}
}


以上。

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