protected void HatchStyle_SelectedIndexChanged(object sender, System.EventArgs e) { Gradient.SelectedIndex = 0; // Set Hatch Style Chart1.BackHatchStyle = (ChartHatchStyle)ChartHatchStyle.Parse(typeof(ChartHatchStyle), HatchStyle.SelectedItem.Text); Chart1.BackGradientStyle = GradientStyle.None; }
private void ControlChanged(object sender, System.EventArgs e) { if (this.StripEndColor.SelectedIndex >= 0) { this.Chart1.ChartAreas[0].AxisX.StripLines[0].BackSecondaryColor = Color.FromName(this.StripEndColor.SelectedItem.ToString()); } if (this.StripColor.SelectedIndex >= 0) { this.Chart1.ChartAreas[0].AxisX.StripLines[0].BackColor = Color.FromName(this.StripColor.SelectedItem.ToString()); } if (this.LineColor.SelectedIndex >= 0) { this.Chart1.ChartAreas[0].AxisX.StripLines[0].BorderColor = Color.FromName(this.LineColor.SelectedItem.ToString()); } if (this.LineWidth.SelectedIndex >= 0) { this.Chart1.ChartAreas[0].AxisX.StripLines[0].BorderWidth = int.Parse(this.LineWidth.SelectedItem.ToString()); } if (this.Interval.SelectedIndex >= 0) { this.Chart1.ChartAreas[0].AxisX.StripLines[0].Interval = int.Parse(this.Interval.SelectedItem.ToString()); } if (this.HatchStyle.SelectedIndex >= 0) { // Set Hatch Style this.Chart1.ChartAreas[0].AxisX.StripLines[0].BackHatchStyle = (ChartHatchStyle)ChartHatchStyle.Parse(typeof(ChartHatchStyle), this.HatchStyle.SelectedItem.ToString()); } if (this.Gradient.SelectedIndex >= 0) { // Set Gradient Type this.Chart1.ChartAreas[0].AxisX.StripLines[0].BackGradientStyle = (GradientStyle)GradientStyle.Parse(typeof(GradientStyle), this.Gradient.SelectedItem.ToString()); } if (this.StripLinesStyle.SelectedIndex >= 0) { this.Chart1.ChartAreas[0].AxisX.StripLines[0].BorderDashStyle = (ChartDashStyle)ChartDashStyle.Parse(typeof(ChartDashStyle), this.StripLinesStyle.SelectedItem.ToString()); } // Enable/disable attribute contros StripEndColor.Enabled = (Gradient.SelectedIndex != 0 || HatchStyle.SelectedIndex != 0); LineColor.Enabled = (StripLinesStyle.SelectedIndex != 0); LineWidth.Enabled = (StripLinesStyle.SelectedIndex != 0); }
private void AppearanceChange(object sender) { // Set Back Color Chart1.ChartAreas["Default"].BackColor = Color.FromName(BackColorCom.GetItemText(BackColorCom.SelectedItem)); // Set Back Gradient End Color Chart1.ChartAreas["Default"].BackSecondaryColor = Color.FromName(ForeColorCom.GetItemText(ForeColorCom.SelectedItem)); // Set Border Color Chart1.ChartAreas["Default"].BorderColor = Color.FromName(BorderColor.GetItemText(BorderColor.SelectedItem)); // Set Gradient Type if (Gradient.SelectedItem != null) { Chart1.ChartAreas["Default"].BackGradientStyle = (GradientStyle)GradientStyle.Parse(typeof(GradientStyle), Gradient.GetItemText(Gradient.SelectedItem)); } // Set Gradient Type if (HatchStyle.SelectedItem != null) { Chart1.ChartAreas["Default"].BackHatchStyle = (ChartHatchStyle)ChartHatchStyle.Parse(typeof(ChartHatchStyle), HatchStyle.GetItemText(HatchStyle.SelectedItem)); } if (sender == Gradient && Chart1.ChartAreas["Default"].BackGradientStyle != GradientStyle.None) { HatchStyle.SelectedIndex = 0; } if (sender == HatchStyle && Chart1.ChartAreas["Default"].BackHatchStyle != ChartHatchStyle.None) { Gradient.SelectedIndex = 0; } // Set Border Width if (BorderSizeCom.SelectedItem != null) { Chart1.ChartAreas["Default"].BorderWidth = int.Parse(BorderSizeCom.GetItemText(BorderSizeCom.SelectedItem)); } // Set Border Style if (BorderDashStyle.SelectedItem != null) { Chart1.ChartAreas["Default"].BorderDashStyle = (ChartDashStyle)ChartDashStyle.Parse(typeof(ChartDashStyle), BorderDashStyle.GetItemText(BorderDashStyle.SelectedItem)); } // Set Shadow Offset if (ShadowOffset.SelectedItem != null) { Chart1.ChartAreas["Default"].ShadowOffset = int.Parse(ShadowOffset.GetItemText(ShadowOffset.SelectedItem)); } }
public void UpdateColor() { if (!ApplyToPoint.Checked) { // Set Series["Default"] visual attributes Chart1.Series["Default"].Color = Color.FromName(ColorList.SelectedItem.Text); Chart1.Series["Default"].BackSecondaryColor = Color.FromName(EndColorList.SelectedItem.Text); Chart1.Series["Default"].BorderColor = Color.FromName(BorderColorList.SelectedItem.Text); Chart1.Series["Default"].BackGradientStyle = (GradientStyle)GradientStyle.Parse(typeof(GradientStyle), GradientList.SelectedItem.Text); Chart1.Series["Default"].BackHatchStyle = (ChartHatchStyle)ChartHatchStyle.Parse(typeof(ChartHatchStyle), HatchingList.SelectedItem.Text); Chart1.Series["Default"].BorderWidth = int.Parse(BorderSizeList.SelectedItem.Text); Chart1.Series["Default"].BorderDashStyle = (ChartDashStyle)ChartDashStyle.Parse(typeof(ChartDashStyle), BorderDashStyleList.SelectedItem.Text); Chart1.Series["Default"].ShadowOffset = int.Parse(ShadowOffsetList.SelectedItem.Text); // Disable fore color control if gradient or hatching are not used if (HatchingList.SelectedItem.Text == "None" && GradientList.SelectedItem.Text == "None") { EndColorList.Enabled = false; } else { EndColorList.Enabled = true; } } else { // Set Series["Default"] visual attributes Chart1.Series["Default"].Points[2].Color = Color.FromName(ColorList.SelectedItem.Text); Chart1.Series["Default"].Points[2].BackSecondaryColor = Color.FromName(EndColorList.SelectedItem.Text); Chart1.Series["Default"].Points[2].BorderColor = Color.FromName(BorderColorList.SelectedItem.Text); Chart1.Series["Default"].Points[2].BackGradientStyle = (GradientStyle)GradientStyle.Parse(typeof(GradientStyle), GradientList.SelectedItem.Text); Chart1.Series["Default"].Points[2].BackHatchStyle = (ChartHatchStyle)ChartHatchStyle.Parse(typeof(ChartHatchStyle), HatchingList.SelectedItem.Text); Chart1.Series["Default"].Points[2].BorderWidth = int.Parse(BorderSizeList.SelectedItem.Text); Chart1.Series["Default"].Points[2].BorderDashStyle = (ChartDashStyle)ChartDashStyle.Parse(typeof(ChartDashStyle), BorderDashStyleList.SelectedItem.Text); Chart1.Series["Default"].ShadowOffset = int.Parse(ShadowOffsetList.SelectedItem.Text); // Disable fore color control if gradient or hatching are not used if (HatchingList.SelectedItem.Text == "None" && GradientList.SelectedItem.Text == "None") { EndColorList.Enabled = false; } else { EndColorList.Enabled = true; } } }
private void ChartAppearanceChange() { // Enable/disable appearance controls ForeColorCom.Enabled = (HatchStyle.SelectedIndex != 0 || Gradient.SelectedIndex != 0); BorderColor.Enabled = (BorderDashStyle.SelectedIndex != 0); BorderSizeCom.Enabled = (BorderDashStyle.SelectedIndex != 0); // Set Back Color Chart1.BackColor = Color.FromName(BackColorCom.GetItemText(BackColorCom.SelectedItem)); // Set Back Gradient End Color Chart1.BackSecondaryColor = Color.FromName(ForeColorCom.GetItemText(ForeColorCom.SelectedItem)); // Set Gradient Type if (Gradient.SelectedItem != null) { Chart1.BackGradientStyle = (GradientStyle)GradientStyle.Parse(typeof(GradientStyle), Gradient.GetItemText(Gradient.SelectedItem)); } // Set Gradient Type if (HatchStyle.SelectedItem != null) { Chart1.BackHatchStyle = (ChartHatchStyle)ChartHatchStyle.Parse(typeof(ChartHatchStyle), HatchStyle.GetItemText(HatchStyle.SelectedItem)); } // Set background image if (!ShowImageCheck.Checked) { Chart1.BackImage = ""; ImageAlign.Enabled = false; ImageMode.Enabled = false; } else { ImageMode.Enabled = true; ImageAlign.Enabled = (ImageMode.SelectedIndex == 5); // Set chart image MainForm mainForm = (MainForm)this.ParentForm; string imageFileName = mainForm.CurrentSamplePath; imageFileName += "\\Flag.gif"; Chart1.BackImage = imageFileName; Chart1.BackImageTransparentColor = Color.Red; // Set Image Mode if (ImageMode.SelectedItem != null) { Chart1.BackImageWrapMode = (ChartImageWrapMode)ChartImageWrapMode.Parse(typeof(ChartImageWrapMode), ImageMode.SelectedItem.ToString()); } // Set Image Alignment if (ImageAlign.SelectedItem != null) { Chart1.BackImageAlignment = (ChartImageAlignmentStyle)ChartImageAlignmentStyle.Parse(typeof(ChartImageAlignmentStyle), ImageAlign.SelectedItem.ToString()); } } // Set Border Width if (BorderSizeCom.SelectedItem != null) { Chart1.BorderWidth = int.Parse(BorderSizeCom.GetItemText(BorderSizeCom.SelectedItem)); } // Set Border Style if (BorderDashStyle.SelectedItem != null) { Chart1.BorderDashStyle = (ChartDashStyle)ChartDashStyle.Parse(typeof(ChartDashStyle), BorderDashStyle.GetItemText(BorderDashStyle.SelectedItem)); } // Set Border Color Chart1.BorderColor = Color.FromName(BorderColor.GetItemText(BorderColor.SelectedItem)); }
protected void Page_Load(object sender, System.EventArgs e) { if (!this.IsPostBack) { // Add Hatch styles to control. foreach (string colorName in Enum.GetNames(typeof(ChartHatchStyle))) { HatchStyle.Items.Add(colorName); } // Add Chart Gradient types to control. foreach (string colorName in Enum.GetNames(typeof(GradientStyle))) { Gradient.Items.Add(colorName); } // Add Chart Line styles to control. foreach (string colorName in Enum.GetNames(typeof(ChartDashStyle))) { BorderDashStyle.Items.Add(colorName); } BorderDashStyle.SelectedIndex = 5; } // Set Back Color Chart1.ChartAreas["ChartArea1"].BackColor = Color.FromName(BackColor.SelectedItem.Value); // Set Back Gradient End Color Chart1.ChartAreas["ChartArea1"].BackSecondaryColor = Color.FromName(ForeColor.SelectedItem.Value); // Set Hatch Style Chart1.ChartAreas["ChartArea1"].BackHatchStyle = (ChartHatchStyle)ChartHatchStyle.Parse(typeof(ChartHatchStyle), HatchStyle.SelectedItem.Text); // Set Gradient Type Chart1.ChartAreas["ChartArea1"].BackGradientStyle = (GradientStyle)GradientStyle.Parse(typeof(GradientStyle), Gradient.SelectedItem.Text); // Set Border Color Chart1.ChartAreas["ChartArea1"].BorderColor = Color.FromName(BorderColor.SelectedItem.Value); // Set Border Style Chart1.ChartAreas["ChartArea1"].BorderDashStyle = (ChartDashStyle)ChartDashStyle.Parse(typeof(ChartDashStyle), BorderDashStyle.SelectedItem.Text); // Set Border Width Chart1.ChartAreas["ChartArea1"].BorderWidth = int.Parse(BorderSize.SelectedItem.Value); // Disable hatch if gradient is active if (Chart1.ChartAreas["ChartArea1"].BackGradientStyle != GradientStyle.None) { HatchStyle.Enabled = false; } else { HatchStyle.Enabled = true; } // Disable gradient if hatch style is active if (Chart1.ChartAreas["ChartArea1"].BackHatchStyle != ChartHatchStyle.None) { Gradient.Enabled = false; } else { Gradient.Enabled = true; } }
private void AppearanceChange() { // suppress appearance settings during loading if (this.initializing) { return; } // load default chart settings if (defaultChartView.Length > 0) { defaultChartView.Position = 0; Chart1.Serializer.Load(defaultChartView); } // Set Back Color Chart1.Series[0].Points[2].Color = Color.FromName(ColorCom.GetItemText(ColorCom.SelectedItem)); // Set Back Gradient End Color Chart1.Series[0].Points[2].BackSecondaryColor = Color.FromName(EndColorCom.GetItemText(EndColorCom.SelectedItem)); // Set Border Color Chart1.Series[0].Points[2].BorderColor = Color.FromName(BorderColorCom.GetItemText(BorderColorCom.SelectedItem)); // Set Gradient Type if (GradientCom.SelectedItem != null) { Chart1.Series[0].Points[2].BackGradientStyle = (GradientStyle)GradientStyle.Parse(typeof(GradientStyle), GradientCom.GetItemText(GradientCom.SelectedItem)); } // Set Gradient Type if (HatchingCom.SelectedItem != null) { Chart1.Series[0].Points[2].BackHatchStyle = (ChartHatchStyle)ChartHatchStyle.Parse(typeof(ChartHatchStyle), HatchingCom.GetItemText(HatchingCom.SelectedItem)); } // Set Border Width if (BorderSizeCom.SelectedItem != null) { Chart1.Series[0].Points[2].BorderWidth = int.Parse(BorderSizeCom.GetItemText(BorderSizeCom.SelectedItem)); } // Set Border Style if (BorderDashStyleCom.SelectedItem != null) { Chart1.Series[0].Points[2].BorderDashStyle = (ChartDashStyle)ChartDashStyle.Parse(typeof(ChartDashStyle), BorderDashStyleCom.GetItemText(BorderDashStyleCom.SelectedItem)); } if (!this.ThirdPoint.Checked) { // Set Back Color Chart1.Series[0].Color = Color.FromName(ColorCom.GetItemText(ColorCom.SelectedItem)); // Set Back Gradient End Color Chart1.Series[0].BackSecondaryColor = Color.FromName(EndColorCom.GetItemText(EndColorCom.SelectedItem)); // Set Border Color Chart1.Series[0].BorderColor = Color.FromName(BorderColorCom.GetItemText(BorderColorCom.SelectedItem)); // Set Gradient Type if (GradientCom.SelectedItem != null) { Chart1.Series[0].BackGradientStyle = (GradientStyle)GradientStyle.Parse(typeof(GradientStyle), GradientCom.GetItemText(GradientCom.SelectedItem)); } // Set Gradient Type if (HatchingCom.SelectedItem != null) { Chart1.Series[0].BackHatchStyle = (ChartHatchStyle)ChartHatchStyle.Parse(typeof(ChartHatchStyle), HatchingCom.GetItemText(HatchingCom.SelectedItem)); } // Set Border Width if (BorderSizeCom.SelectedItem != null) { Chart1.Series[0].BorderWidth = int.Parse(BorderSizeCom.GetItemText(BorderSizeCom.SelectedItem)); } // Set Border Style if (BorderDashStyleCom.SelectedItem != null) { Chart1.Series[0].BorderDashStyle = (ChartDashStyle)ChartDashStyle.Parse(typeof(ChartDashStyle), BorderDashStyleCom.GetItemText(BorderDashStyleCom.SelectedItem)); } // Set Shadow Offset if (ShadowOffset.SelectedItem != null) { Chart1.Series[0].ShadowOffset = int.Parse(ShadowOffset.GetItemText(ShadowOffset.SelectedItem)); } } }
protected void Page_Load(object sender, System.EventArgs e) { if (!this.IsPostBack) { // Add Hatch styles to control. foreach (string colorName in Enum.GetNames(typeof(ChartHatchStyle))) { HatchStyle.Items.Add(colorName); } // Add Chart Gradient types to control. foreach (string colorName in Enum.GetNames(typeof(GradientStyle))) { Gradient.Items.Add(colorName); } Gradient.Items.FindByValue("None").Selected = true; // Add Chart Line styles to control. foreach (string skinStyle in Enum.GetNames(typeof(BorderSkinStyle))) { SkinStyle.Items.Add(skinStyle); } SkinStyle.Items.FindByValue("Emboss").Selected = true; // Add Border styles to control. foreach (string colorName in Enum.GetNames(typeof(ChartDashStyle))) { BorderDashStyle.Items.Add(colorName); } BorderDashStyle.Items.FindByValue("Solid").Selected = true; // Add Colors to controls. foreach (String colorName in KnownColor.GetNames(typeof(KnownColor))) { BackColor.Items.Add(colorName); ForeColor.Items.Add(colorName); BorderColor.Items.Add(colorName); } BackColor.Items.FindByValue("PeachPuff").Selected = true; ForeColor.Items.FindByValue("White").Selected = true; BorderColor.Items.FindByValue("Maroon").Selected = true; } // Set Border Skin Chart1.BorderSkin.SkinStyle = (BorderSkinStyle)ChartHatchStyle.Parse(typeof(BorderSkinStyle), SkinStyle.SelectedItem.Text); // disable controls this.ForeColor.Enabled = this.IsFrameStyle(); this.BackColor.Enabled = this.IsFrameStyle(); // set default appearance Chart1.BorderSkin.BorderDashStyle = ChartDashStyle.NotSet; Chart1.BorderSkin.BorderColor = Color.Empty; Chart1.BorderSkin.BorderWidth = 1; Chart1.BorderlineDashStyle = ChartDashStyle.NotSet; Chart1.BorderColor = Color.Empty; Chart1.BorderWidth = 1; if (this.IsFrameStyle()) { // Set Back Color Chart1.BorderSkin.BackColor = Color.FromName(BackColor.SelectedItem.Value); // Set Back Gradient End Color Chart1.BorderSkin.BackSecondaryColor = Color.FromName(ForeColor.SelectedItem.Value); // Set Hatch Style Chart1.BorderSkin.BackHatchStyle = (ChartHatchStyle)ChartHatchStyle.Parse(typeof(ChartHatchStyle), HatchStyle.SelectedItem.Text); // Set Gradient Type Chart1.BorderSkin.BackGradientStyle = (GradientStyle)GradientStyle.Parse(typeof(GradientStyle), Gradient.SelectedItem.Text); // Set Border Color Chart1.BorderSkin.BorderColor = Color.FromName(BorderColor.SelectedItem.Value); // Set Border Style Chart1.BorderSkin.BorderDashStyle = (ChartDashStyle)ChartDashStyle.Parse(typeof(ChartDashStyle), BorderDashStyle.SelectedItem.Text); // Set Border Width Chart1.BorderSkin.BorderWidth = int.Parse(BorderSize.SelectedItem.Value); } else { // Set Border Line Color Chart1.BorderColor = Color.FromName(BorderColor.SelectedItem.Value); // Set Border Line Style Chart1.BorderlineDashStyle = (ChartDashStyle)ChartDashStyle.Parse(typeof(ChartDashStyle), BorderDashStyle.SelectedItem.Text); // Set Border Line Width Chart1.BorderWidth = int.Parse(BorderSize.SelectedItem.Value); } // Disable hatch if gradient is active if (this.IsFrameStyle() && Chart1.BorderSkin.BackGradientStyle == GradientStyle.None) { HatchStyle.Enabled = true; } else { HatchStyle.Enabled = false; } // Disable gradient if hatch style is active if (this.IsFrameStyle() && Chart1.BorderSkin.BackHatchStyle == ChartHatchStyle.None) { Gradient.Enabled = true; } else { Gradient.Enabled = false; } }
protected void Page_Load(object sender, System.EventArgs e) { if (!this.IsPostBack) { // Add Hatch styles to control. foreach (string colorName in Enum.GetNames(typeof(ChartHatchStyle))) { HatchStyle.Items.Add(colorName); } HatchStyle.Items[0].Selected = true; // Add Chart Gradient types to control. foreach (string colorName in Enum.GetNames(typeof(GradientStyle))) { Gradient.Items.Add(colorName); } // Add Chart Line styles to control. foreach (string colorName in Enum.GetNames(typeof(ChartDashStyle))) { BorderDashStyle.Items.Add(colorName); } BorderDashStyle.Items.FindByValue("Solid").Selected = true; // Add Image Mode foreach (string item in Enum.GetNames(typeof(ChartImageWrapMode))) { ImageMode.Items.Add(item); } ImageMode.SelectedIndex = 5; // Add Image Aligne foreach (string item in Enum.GetNames(typeof(ChartImageAlignmentStyle))) { ImageAlign1.Items.Add(item); } ImageAlign1.SelectedIndex = 2; } // Set Back Color Chart1.BackColor = Color.FromName(BackColor.SelectedItem.Value); // Set Back Gradient End Color Chart1.BackSecondaryColor = Color.FromName(ForeColor.SelectedItem.Value); // Set Hatch Style Chart1.BackHatchStyle = (ChartHatchStyle)ChartHatchStyle.Parse(typeof(ChartHatchStyle), HatchStyle.SelectedItem.Text); // Set Gradient Type Chart1.BackGradientStyle = (GradientStyle)GradientStyle.Parse(typeof(GradientStyle), Gradient.SelectedItem.Text); // Set Border Color Chart1.BorderColor = Color.FromName(BorderColor.SelectedItem.Value); // Set Border Style Chart1.BorderlineDashStyle = (ChartDashStyle)ChartDashStyle.Parse(typeof(ChartDashStyle), BorderDashStyle.SelectedItem.Text); // Set Border Width Chart1.BorderWidth = int.Parse(BorderSize.SelectedItem.Value); // Chart Image Mode Chart1.BackImageWrapMode = (ChartImageWrapMode)ChartImageWrapMode.Parse(typeof(ChartImageWrapMode), ImageMode.SelectedItem.Text); // Chart Image Align Chart1.BackImageAlignment = (ChartImageAlignmentStyle)ChartImageAlignmentStyle.Parse(typeof(ChartImageAlignmentStyle), ImageAlign1.SelectedItem.Text); // Disable secondary back color if gradient and hatching are not used ForeColor.Enabled = (HatchStyle.SelectedIndex != 0 || Gradient.SelectedIndex != 0); // Set Image ImageAlign1.Enabled = false; ImageMode.Enabled = Image1.Checked; if (Image1.Checked) { Chart1.BackImage = "Flag.gif"; Chart1.BackImageTransparentColor = Color.White; if (ImageMode.SelectedItem.Value == "Unscaled") { ImageAlign1.Enabled = true; } } else { Chart1.BackImage = ""; } // Enable/disable border attributes BorderColor.Enabled = (BorderDashStyle.SelectedIndex != 0); BorderSize.Enabled = (BorderDashStyle.SelectedIndex != 0); }