Jump to content
Software FX Community

duanebalsiger

Members
  • Posts

    1
  • Joined

  • Last visited

Everything posted by duanebalsiger

  1. I am inserting a AnnotationRectangle into a bar chart using and setting "PaintBefore" to TRUE so that it appears behind as a background to a portion of the chart. The bar chart and point labels appear on top of the chart, but the Axis labels and tickmarks appear behind the chart. Has anyone encountered this before? What do I need to add or change for it to work? If I can't get the labels to show up I will have to write them out as annotations - not the optimal solution. Below is the code - thanks! Chart1.Background = New SolidBackground(System.Drawing.Color.White) Chart1.Border = New SimpleBorder(SimpleBorderType.None) Chart1.DataGrid.Visible = False Chart1.Gallery = ChartFX.WebForms.Gallery.Bar Chart1.AllSeries.Horizontal = True Chart1.AllSeries.AxisX.Inverted = True Chart1.Height = 504 Chart1.ImageSettings.Interactive = False Chart1.ImageSettings.ToolTips = ImageToolTipStyle.None Chart1.LegendBox.Visible = False Chart1.RenderFormat = "Image" Chart1.ToolBar.Visible = False 'hide the toolbar Chart1.Width = 750 Chart1.Data.Series = 1 Chart1.Data.Points = 13 Chart1.Data.Item(0, 0) = 70 Chart1.Data.Item(0, 1) = 60 Chart1.Data.Item(0, 2) = 40 Chart1.Data.Item(0, 3) = 50 Chart1.Data.Item(0, 4) = 70 Chart1.Data.Item(0, 5) = 60 Chart1.Data.Item(0, 6) = 40 Chart1.Data.Item(0, 7) = 50 Chart1.Data.Item(0, 8) = 40 Chart1.Data.Item(0, 9) = 50 Chart1.Data.Item(0, 10) = 70 Chart1.Data.Item(0, 11) = 60 Chart1.Data.Item(0, 12) = 50 Chart1.AllSeries.AxisX.Labels(0) = "Label 1" Chart1.AllSeries.AxisX.Labels(1) = "Label 2" Chart1.AllSeries.AxisX.Labels(2) = "Label 3" Chart1.AllSeries.AxisX.Labels(3) = "Label 4" Chart1.AllSeries.AxisX.Labels(4) = "Label 5" Chart1.AllSeries.AxisX.Labels(5) = "Label 6" Chart1.AllSeries.AxisX.Labels(6) = "Label 7" Chart1.AllSeries.AxisX.Labels(7) = "Label 8" Chart1.AllSeries.AxisX.Labels(8) = "Label 9" Chart1.AllSeries.AxisX.Labels(9) = "Label 10" Chart1.AllSeries.AxisX.Labels(10) = "Label 11" Chart1.AllSeries.AxisX.Labels(11) = "Label 12" Chart1.AllSeries.AxisX.Labels(12) = "Label 13" Chart1.AllSeries.AxisY.Max = 100 Chart1.AllSeries.AxisY.Min = 0 Chart1.AllSeries.AxisY.Visible = False Chart1.AllSeries.AxisX.Font = New System.Drawing.Font("Arial", 10, System.Drawing.FontStyle.Regular) Chart1.AllSeries.AxisX.Grids.Major.Visible = False Chart1.AllSeries.AxisX.Grids.Minor.Visible = False Chart1.AllSeries.AxisX.Step = 1 Chart1.AllSeries.AxisX.Grids.Major.TickMark = TickMark.Outside Chart1.AllSeries.AxisX.Grids.Minor.TickMark = TickMark.None Chart1.AllSeries.AxisX.LabelTrimming = Drawing.StringTrimming.None Chart1.AllSeries.Line.Style = Drawing.Drawing2D.DashStyle.Solid Chart1.AllSeries.MarkerShape = MarkerShape.Diamond Chart1.AllSeries.PointLabels.Visible = True Chart1.AllSeries.PointLabels.Font = New System.Drawing.Font("Arial", 10, System.Drawing.FontStyle.Regular) Chart1.AllSeries.PointLabels.Format = "%v%%" Chart1.MainPane.Background = New SolidBackground(System.Drawing.Color.White) Chart1.AxesStyle = AxesStyle.None Chart1.PlotAreaMargin.Right = 200 Chart1.PlotAreaMargin.Left = 240 Chart1.PlotAreaMargin.Bottom = -1 Chart1.UpdateSizeNow() Dim annot As ChartFX.WebForms.Annotation.Annotations = New ChartFX.WebForms.Annotation.Annotations() Chart1.Extensions.Add(annot) Dim Header As ChartFX.WebForms.Annotation.AnnotationText = New ChartFX.WebForms.Annotation.AnnotationText Header.Font = New System.Drawing.Font("Arial", 12, System.Drawing.FontStyle.Bold) Header.Text = "% Excellent" Header.Top = 9 Header.Left = 5 Header.Border.Width = 0 Header.Border.Color = Drawing.Color.Transparent annot.List.Add(Header) Dim UnitWidth As Decimal = (Chart1.AxisX.ValueToPixel(2) - Chart1.AxisX.ValueToPixel(1)) Dim Line1 As Decimal = Chart1.AxisX.ValueToPixel(1) - UnitWidth / 2 Dim Line2 As Decimal = Chart1.AxisX.ValueToPixel(6) - UnitWidth / 2 Dim Line3 As Decimal = Chart1.AxisX.ValueToPixel(11) - UnitWidth / 2 Dim Line4 As Decimal = Chart1.AxisX.ValueToPixel(13) + UnitWidth / 2 Dim BgRect1 As ChartFX.WebForms.Annotation.AnnotationRectangle = New ChartFX.WebForms.Annotation.AnnotationRectangle BgRect1.PaintBefore = True BgRect1.Left = 200 BgRect1.Top = Line1 BgRect1.Width = 750 BgRect1.Height = Line2 - Line1 BgRect1.Color = Drawing.ColorTranslator.FromHtml("#d8d8d8") BgRect1.Border.Color = Drawing.Color.Transparent annot.List.Add(BgRect1) Dim BgRect2 As ChartFX.WebForms.Annotation.AnnotationRectangle = New ChartFX.WebForms.Annotation.AnnotationRectangle BgRect2.PaintBefore = True BgRect2.Left = 0 BgRect2.Top = Line2 BgRect2.Width = 750 BgRect2.Height = Line3 - Line2 BgRect2.Color = Drawing.ColorTranslator.FromHtml("#cccccc") BgRect2.Border.Color = Drawing.Color.Transparent annot.List.Add(BgRect2) Dim BgRect3 As ChartFX.WebForms.Annotation.AnnotationRectangle = New ChartFX.WebForms.Annotation.AnnotationRectangle BgRect3.PaintBefore = True BgRect3.Left = 0 BgRect3.Top = Line3 BgRect3.Width = 750 BgRect3.Height = Line4 - Line3 BgRect3.Color = Drawing.ColorTranslator.FromHtml("#b8b8b8") BgRect3.Border.Color = Drawing.Color.Transparent annot.List.Add(BgRect3) Dim SideHeader1 As ChartFX.WebForms.Annotation.AnnotationText = New ChartFX.WebForms.Annotation.AnnotationText SideHeader1.Font = New System.Drawing.Font("Arial", 12, System.Drawing.FontStyle.Bold) SideHeader1.Text = "Group 1" SideHeader1.Top = Line1 + ((Line2 - Line1) / 2) - 10 SideHeader1.Left = -((Line2 - Line1) / 2) + 10 SideHeader1.Align = Drawing.StringAlignment.Center SideHeader1.Width = Line2 - Line1 SideHeader1.Height = 20 SideHeader1.Border.Color = Drawing.Color.Transparent SideHeader1.Rotate(False) annot.List.Add(SideHeader1) Dim SideHeader2 As ChartFX.WebForms.Annotation.AnnotationText = New ChartFX.WebForms.Annotation.AnnotationText SideHeader2.Font = New System.Drawing.Font("Arial", 12, System.Drawing.FontStyle.Bold) SideHeader2.Text = "Group 2" SideHeader2.Top = Line2 + ((Line3 - Line2) / 2) - 10 SideHeader2.Left = -((Line3 - Line2) / 2) + 10 SideHeader2.Align = Drawing.StringAlignment.Center SideHeader2.Width = Line3 - Line2 SideHeader2.Height = 20 SideHeader2.Border.Color = Drawing.Color.Transparent SideHeader2.Rotate(False) annot.List.Add(SideHeader2) Dim SideHeader3 As ChartFX.WebForms.Annotation.AnnotationText = New ChartFX.WebForms.Annotation.AnnotationText SideHeader3.Font = New System.Drawing.Font("Arial", 12, System.Drawing.FontStyle.Bold) SideHeader3.Text = "Group 3" SideHeader3.Top = Line3 + ((Line4 - Line3) / 2) - 20 SideHeader3.Left = -((Line4 - Line3) / 2) + 20 SideHeader3.Align = Drawing.StringAlignment.Center SideHeader3.Width = Line4 - Line3 SideHeader3.Height = 40 SideHeader3.Border.Color = Drawing.Color.Transparent SideHeader3.Rotate(False) annot.List.Add(SideHeader3) Dim Rect As ChartFX.WebForms.Annotation.AnnotationRectangle = New ChartFX.WebForms.Annotation.AnnotationRectangle Rect.Height = 1 Rect.Width = 740 Rect.Left = 5 Rect.Top = 2 Rect.Color = Drawing.Color.Black annot.List.Add(Rect)
×
×
  • Create New...