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 WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
bool hogehoge = true;
private void button1_Click(object sender, EventArgs e)
{
Series series1 = new Series("y = x*x");
Series series2 = new Series("y = 5*x+20");
for (int x = 1; x < 10; x++)
{
series1.Points.AddXY(x, x * x);
series2.Points.AddXY(x, 5 * x + 20);
}
{
series1.Color = Color.Red;
series1.MarkerSize = 15;
series1.MarkerStyle = System.Windows.Forms.DataVisualization.Charting.MarkerStyle.Diamond;
series1.IsValueShownAsLabel = true;
series1.LabelForeColor = Color.Blue;
series1.ChartType = SeriesChartType.Line; // グラフ形状
if(hogehoge) series1.BorderWidth = 10; //これで太さが変わる
}
{
series2.Color = Color.Blue;
series2.MarkerColor = Color.Blue;
//series2.MarkerSize = 20;
series2.MarkerStyle = System.Windows.Forms.DataVisualization.Charting.MarkerStyle.Circle;
series2.ChartType = SeriesChartType.FastLine;
if (hogehoge) series2.BorderWidth = 10; //これで太さが変わる
}
{
chart1.Series.Clear();
chart1.Series.Add(series1);
chart1.Series.Add(series2);
chart1.ChartAreas[0].BackColor = Color.LightCyan;
}
{
Axis ax = chart1.ChartAreas[0].AxisX;
ax.MajorGrid.LineColor = Color.LightGray;
Axis ay = chart1.ChartAreas[0].AxisY;
ay.MajorGrid.LineColor = Color.LightGray;
}
hogehoge = !hogehoge;
}
}
}