private void ControlChange(object sender, System.EventArgs e) { if (InsideCheck.Checked) { Chart1.Legends["Default"].InsideChartArea = "Default"; } else { Chart1.Legends["Default"].InsideChartArea = ""; } Chart1.Legends["Default"].Enabled = !DisableCheck.Checked; if (this.TheStyle.SelectedItem.ToString() == "Table" && !this.DisableCheck.Checked) { this.TheTableStyle.Enabled = true; } else { this.TheTableStyle.Enabled = false; } if (this.TheTableStyle.SelectedIndex >= 0) { Chart1.Legends["Default"].TableStyle = (LegendTableStyle)LegendTableStyle.Parse(typeof(LegendTableStyle), this.TheTableStyle.SelectedItem.ToString()); } if (this.TheStyle.SelectedIndex >= 0) { Chart1.Legends["Default"].LegendStyle = (LegendStyle)LegendStyle.Parse(typeof(LegendStyle), this.TheStyle.SelectedItem.ToString()); } if (this.TheDocking.SelectedIndex >= 0) { Chart1.Legends["Default"].Docking = (Docking)Docking.Parse(typeof(Docking), this.TheDocking.SelectedItem.ToString()); } if (this.TheAlignment.SelectedIndex >= 0) { Chart1.Legends["Default"].Alignment = (StringAlignment)StringAlignment.Parse(typeof(StringAlignment), this.TheAlignment.SelectedItem.ToString()); } if (this.cb_Reversed.Checked) { Chart1.Legends["Default"].LegendItemOrder = LegendItemOrder.ReversedSeriesOrder; } else { Chart1.Legends["Default"].LegendItemOrder = LegendItemOrder.SameAsSeriesOrder; } }
private void SetupChart() { // Set legend style Chart1.Legends["Default"].LegendStyle = (LegendStyle)LegendStyle.Parse(typeof(LegendStyle), LegendStyleList.SelectedItem.Text); // Set legend docking Chart1.Legends["Default"].Docking = (Docking)Docking.Parse(typeof(Docking), LegendDockingList.SelectedItem.Text); // Set legend alignment Chart1.Legends["Default"].Alignment = (StringAlignment)StringAlignment.Parse(typeof(StringAlignment), LegendAlinmentList.SelectedItem.Text); // Set whether the legend is reversed if (this.Reversed.Checked) { Chart1.Legends["Default"].LegendItemOrder = LegendItemOrder.ReversedSeriesOrder; } else { Chart1.Legends["Default"].LegendItemOrder = LegendItemOrder.SameAsSeriesOrder; } // Display legend in the "Default" chart area if (InsideChartArea.Checked) { Chart1.Legends["Default"].InsideChartArea = "ChartArea1"; } // Set table style this.Chart1.Legends["Default"].TableStyle = (LegendTableStyle)LegendTableStyle.Parse(typeof(LegendTableStyle), this.TheTableStyle.SelectedItem.ToString()); if (this.LegendStyleList.SelectedItem.ToString() == "Table" && !this.LegendDisabled.Checked) { this.TheTableStyle.Enabled = true; } else { this.TheTableStyle.Enabled = false; } }