public void loadChartSoldItems() { try { Controller.posController pos = new Controller.posController(); MySqlDataAdapter sda = pos.loadChartSoldItems(soldItems.dateTimePicker4.Value.ToString("yyyy-MM-dd"), soldItems.dateTimePicker3.Value.ToString("yyyy-MM-dd")); DataSet data = new DataSet(); sda.Fill(data, "SOLDITEMS"); chart1.DataSource = data.Tables["SOLDITEMS"]; Series series = chart1.Series[0]; series.ChartType = SeriesChartType.Doughnut; series.LabelForeColor = Color.White; series.Name = "SOLD ITEMS"; var chart = chart1; chart1.Series[0].XValueMember = "description"; chart1.Series[0].YValueMembers = "total"; chart.Series[0].IsValueShownAsLabel = true; chart.Series[0].LabelFormat = "{#,##0.00}"; } catch (Exception ex) { MessageBox.Show(ex.Message); } }