Where did the chart question go that was here earlier???

  • Thread starter Thread starter tommytwotrain
  • Start date Start date
T

tommytwotrain

Guest
I made this answer for the chart question posted here earlier. Seems it was here??



1553198.png

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

namespace Test_C
{
public partial class Form3 : Form
{
public Form3()
{
InitializeComponent();
}

private void Form3_Load(object sender, EventArgs e)
{
ClientSize = new Size(700, 300);

chart1.ChartAreas[0].AxisX.Title = "Date";
chart1.ChartAreas[0].AxisX.MajorGrid.LineColor = Color.LightBlue;
chart1.ChartAreas[0].AxisY.Title = "Value";
chart1.ChartAreas[0].AxisY.MajorGrid.LineColor = Color.LightGray;
chart1.ChartAreas[0].AxisX.LabelStyle.Interval = 1;
chart1.ChartAreas[0].AxisX.MajorGrid.Interval = 1;
chart1.ChartAreas[0].AxisX.MajorTickMark.Interval = 1;
chart1.ChartAreas[0].AxisX.IntervalType = DateTimeIntervalType.Months;
chart1.ChartAreas[0].AxisX.LabelStyle.Format = "MMM";
chart1.ChartAreas[0].AxisX.LabelStyle.IsEndLabelVisible = true;

chart1.ChartAreas[0].AxisY.Minimum = 0;
chart1.ChartAreas[0].AxisY.Maximum = 100000;
chart1.ChartAreas[0].AxisX.IsMarginVisible = true;


chart1.Series[0].ChartType = SeriesChartType.Line;
chart1.Series[0].BorderWidth = 2;
chart1.Series[0].Color = Color.Red;
chart1.Series[0].BorderDashStyle = ChartDashStyle.Solid;

chart1.Series.Add("Series 2");
chart1.Series[1].ChartType = SeriesChartType.Line;
chart1.Series[1].BorderWidth = 2;
chart1.Series[1].Color = Color.Blue;
chart1.Series[1].BorderDashStyle = ChartDashStyle.Solid;

var date1 = new DateTime(2008, 1, 1);
DateTime thisDate;
var rand = new Random();

for (int d = 0; d <= 365; d+=10)
{
thisDate = date1.AddDays(d);
chart1.Series[0].Points.AddXY(thisDate, rand.Next(30000, 40000));
chart1.Series[1].Points.AddXY(thisDate, rand.Next(50000, 70000));
}


}
}
}

Continue reading...
 

Similar threads

V
Replies
0
Views
116
Vergassivellaunus
V
V
Replies
0
Views
94
Vergassivellaunus
V
V
Replies
0
Views
92
Vergassivellaunus
V
Back
Top