Example #1
0
        public static void DateChanged(LiveCharts.WinForms.CartesianChart input, ComboBox c1, ComboBox c2, MetroDateTime startDate, MetroDateTime endDate)
        {
            //Validate
            if (GetDate(endDate) < GetDate(startDate))
            {
                MessageBox.Show("The end date cannot be before the startDate", "Invalid input", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            if (GetDate(endDate).Subtract(GetDate(startDate)).TotalDays > 365 * 2)
            {
                DialogResult result = MessageBox.Show("Please note that if you select a range longer than 2 years, the perfomance will degrate. Do you want to proceed?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                if (result == DialogResult.No)
                {
                    return;
                }
            }

            UpdateChartData.UpdateFirstSeries(input, c1, c2, startDate, endDate);
            UpdateChartData.UpdateSecondSeries(input, c1, c2, startDate, endDate);
        }
 private void ChooseStockIndex2_SelectedIndexChanged(object sender, EventArgs e)
 {
     VisualizeComboBox.IfComboBoxesTheSame(ChooseStockIndex1, ChooseStockIndex2);
     UpdateChartData.UpdateSecondSeries(this.StockIndexLineChart, this.ChooseStockIndex1, this.ChooseStockIndex2, this.ChooseStartDate, this.ChooseEndDate);
 }