List of Exercises

How to Make PIE Chart by LiveCharts in WinForms c#

	    
using LiveCharts;
using LiveCharts.Wpf;
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;

namespace Live_Chart_in_WinForms
{
  public partial class Form1 : Form
  {
    public Form1()
    {
      InitializeComponent();
    }
    private void Add_PieChart_Click(object sender, EventArgs e)
    {
      LiveCharts.WinForms.PieChart pieChart = new LiveCharts.WinForms.PieChart();
      pieChart.Width = 200;
      pieChart.Height = 200;
      Random rnd = new Random();
      SeriesCollection sers = new SeriesCollection();
      for (int n = 0; n < 5; n++)
      {
        PieSeries ser = new PieSeries();
        ser.Values = new ChartValues<double> { Math.Round(rnd.NextDouble(), 2) };
        ser.Title = "ID" + (n + 1).ToString();
        ser.DataLabels = true;
        sers.Add(ser);
      }

      pieChart.Series = sers;
      this.panel1.Controls.Clear();
      this.panel1.Controls.Add(pieChart);
    }
  }
}

		
	 


Download the project of Visual Studio 2013 in DropBox Download


How to create a basic PIE Chart in Winforms C# using LiveCharts


Video Thumbnail