Skip to content

Instantly share code, notes, and snippets.

@zelinskiy
Created April 9, 2017 18:26
Show Gist options
  • Select an option

  • Save zelinskiy/dd1bef8eb2808a67dfada32939bb2f76 to your computer and use it in GitHub Desktop.

Select an option

Save zelinskiy/dd1bef8eb2808a67dfada32939bb2f76 to your computer and use it in GitHub Desktop.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms.DataVisualization.Charting;
using System.Windows.Forms;
using System.Windows.Forms.DataVisualization.Charting;
namespace ConsoleApplication1
{
class Program
{
[STAThread]
static void Main(string[] args)
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
var f = new ChartForm();
Console.WriteLine("END");
Console.ReadKey();
}
}
class ChartForm :Form
{
public ChartForm()
{
InitializeComponent();
var series = new Series();
series.ChartType = SeriesChartType.Point;
var r = new Random();
for (int i = 0; i < 100; i++)
{
series.Points.AddXY(r.Next(1, 100), r.Next(1, 100));
}
chart1.Series.Add(series);
chart1.SaveImage("lol.png", ChartImageFormat.Png);
Close();
}
#region COPIED_BULLSHIT
private System.ComponentModel.IContainer components = null;
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
private void InitializeComponent()
{
System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea1 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
System.Windows.Forms.DataVisualization.Charting.Legend legend1 = new System.Windows.Forms.DataVisualization.Charting.Legend();
System.Windows.Forms.DataVisualization.Charting.Series series1 = new System.Windows.Forms.DataVisualization.Charting.Series();
this.chart1 = new System.Windows.Forms.DataVisualization.Charting.Chart();
((System.ComponentModel.ISupportInitialize)(this.chart1)).BeginInit();
this.SuspendLayout();
//
// chart1
//
chartArea1.Name = "ChartArea1";
this.chart1.ChartAreas.Add(chartArea1);
legend1.Name = "Legend1";
this.chart1.Legends.Add(legend1);
this.chart1.Location = new System.Drawing.Point(13, 13);
this.chart1.Name = "chart1";
series1.ChartArea = "ChartArea1";
series1.Legend = "Legend1";
series1.Name = "Series1";
this.chart1.Series.Add(series1);
this.chart1.Size = new System.Drawing.Size(662, 311);
this.chart1.TabIndex = 0;
this.chart1.Text = "chart1";
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(687, 336);
this.Controls.Add(this.chart1);
this.Name = "Form1";
this.Text = "Form1";
((System.ComponentModel.ISupportInitialize)(this.chart1)).EndInit();
this.ResumeLayout(false);
}
private System.Windows.Forms.DataVisualization.Charting.Chart chart1;
#endregion
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment