using System; using System.Diagnostics; using System.Windows.Forms; using System.Windows.Forms.DataVisualization.Charting; using Excel = Microsoft.Office.Interop.Excel; using System.Runtime.InteropServices; using RegGlobals = FoodPantryGlobals.GlobalConst; using Food_Pantry; using OfficeOpenXml; using Microsoft.Office.Interop.Excel; using System.Drawing; using Series = Microsoft.Office.Interop.Excel.Series;
private void ChartSetup() { chartTotals.Visible = true; chartTotals.Enabled = true; chartTotals.ChartAreas[0].AxisX.LabelStyle.Interval = 1; chartTotals.ChartAreas[0].AxisX.Maximum = intEmptyRow - 4; chartTotals.ChartAreas[0].AxisX.Minimum = 0; chartTotals.ChartAreas[0].AxisY.Maximum = 1000; chartTotals.ChartAreas[0].AxisX.Minimum = 0; for (int i = 0; i < dgvExcel.RowCount - 2; i++) { // Get the date from the datagridview string strMonth = dgvExcel.Rows[i].Cells[0].Value.ToString(); // Strip out the month from the datagridview data strMonth = strMonth.Substring(0,3); // Assign the month to the x axis chartTotals.Series[0].AxisLabel = strMonth; } chartTotals.ChartAreas[0].RecalculateAxesScale(); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)