Search code examples
.netvb.netactivereports

Is it possible to modify the style of the line between two points of a Line graph of an Active Reports Chart Control?


I would like to modify the segment line between two points of an Active Reports NET7 version Line graph made with this object:

GrapeCity.ActiveReports.SectionReportModel.ChartControl

I have been checking the properties of the chart control, and I was able to manipulate a single point of a serie as follows:

Me.ChartControl1.Series("MySerie1").Points.Item(1).IsEmpty = True

Setting IsEmpty to True makes the graph jump that x-axis value so it makes something like this (in the example it is jumping x=H24/9):

enter image description here

But I would like also to be able to modify the segment between the previous and next points to the one I made empty, making it a dash or a dot line like this:

enter image description here

I thought that something like the following code would do the trick:

Me.ChartControl1.Series("MySerie1").Points.Item(1).Line.Style=Chart.Graphics.LineStyle.Dash

But it does not work.

I would like to ask the following questions:

  1. Is it possible to modify a single segment?

  2. Is there another way to do the same? (maybe two series instead of one, but I can not see right now an easy way to do that) Thank you!


Solution

    1. no, it is not possible to modify the single segment of series line.
    2. yes, it can be done in 2 series, but you will need to choose LineXY series type instead of common Line type.
    3. as workaround, i would recommend to add AnnotationLine to the chart. here is a sample of code(note: X = 0,5 for first point;X = 1,5 for the second point and so on):

    Dim aline As New GrapeCity.ActiveReports.Chart.Annotations.AnnotationLine

    aline.Line.Color = Color.White

    aline.Line.Style = Chart.Graphics.LineStyle.Dash

    aline.StartPoint.X = 0.5

    aline.StartPoint.Y = Me.ChartControl1.Series(0).Points.Item(0).YValues(0)

    aline.EndPoint.X = 2.5

    aline.EndPoint.Y = Me.ChartControl1.Series(0).Points.Item(2).YValues(0)

    Me.ChartControl1.Series(0).Annotations.Add(aline)