Need help, Drawing Grid Lines
Posted: Wed May 12, 2004 9:10 pm
I'm ripping my hair out over here so hopefully you guys can help. I need to do the following:
I need to display a graph, with one axes being dates, and the other standard deviations. The SD axis can be set to a max of +/- 2, 3, or 4 standard deviations. The 0, +2, and -2 grid lines need to be solid lines, and darker than the other lines. All of the other grid lines (+/- 1, +/- 3, and all .5 increments) need to be dotted. When all is said and done, I need to change the axis labels to explicitly show the value for each increment of the standard deviation (for instance, if the SD is 3, then I need to change the label for 1 to be 3, 2 to be 6, 3.5 to be 10.5, etc).
I have everything working except the darker lines at 0, and +/- 2 SD.
Using:
Set oDrawLineTool = oForm.tcGraph.Tools.Items(oForm.tcGraph.Tools.Add(tcDrawLine)).asDrawLine
With oDrawLineTool
.Pen.Style = psSolid
Call .AddLine(oForm.tcGraph.Axis.Bottom.MinXValue, -2, oForm.tcGraph.Axis.Bottom.MaxXValue, -2)
Call .AddLine(oForm.tcGraph.Axis.Bottom.MinXValue, 0, oForm.tcGraph.Axis.Bottom.MaxXValue, 0)
Call .AddLine(oForm.tcGraph.Axis.Bottom.MinXValue, 2, oForm.tcGraph.Axis.Bottom.MaxXValue, 2)
.EnableDraw = False
.EnableSelect = False
End With
I can draw the solid lines at the appropriate places. But when I try to add:
.pen.width = 2
It removes all of the newly drawn lines from the graph and I'm left with the old grid. And for some inexplicable reason, I can't get:
With TChart1
.Canvas.Brush.Style = bsSolid
.Canvas.Pen.Style = psSolid
.Canvas.Pen.Visible = True
.Canvas.Pen.Width = 2
Call .Canvas.MoveTo(TChart1.Axis.Bottom.MinXValue, 0)
Call .Canvas.LineTo(TChart1.Axis.Bottom.MaxXValue, 0)
End With
to do anything. I'm sure i'm doing something horribly wrong here. If anyone can point it out to me, I'd be greatly appreciative. All i need to do is draw dark lines at these 3 places. Any method of doing so is okay with me.
I need to display a graph, with one axes being dates, and the other standard deviations. The SD axis can be set to a max of +/- 2, 3, or 4 standard deviations. The 0, +2, and -2 grid lines need to be solid lines, and darker than the other lines. All of the other grid lines (+/- 1, +/- 3, and all .5 increments) need to be dotted. When all is said and done, I need to change the axis labels to explicitly show the value for each increment of the standard deviation (for instance, if the SD is 3, then I need to change the label for 1 to be 3, 2 to be 6, 3.5 to be 10.5, etc).
I have everything working except the darker lines at 0, and +/- 2 SD.
Using:
Set oDrawLineTool = oForm.tcGraph.Tools.Items(oForm.tcGraph.Tools.Add(tcDrawLine)).asDrawLine
With oDrawLineTool
.Pen.Style = psSolid
Call .AddLine(oForm.tcGraph.Axis.Bottom.MinXValue, -2, oForm.tcGraph.Axis.Bottom.MaxXValue, -2)
Call .AddLine(oForm.tcGraph.Axis.Bottom.MinXValue, 0, oForm.tcGraph.Axis.Bottom.MaxXValue, 0)
Call .AddLine(oForm.tcGraph.Axis.Bottom.MinXValue, 2, oForm.tcGraph.Axis.Bottom.MaxXValue, 2)
.EnableDraw = False
.EnableSelect = False
End With
I can draw the solid lines at the appropriate places. But when I try to add:
.pen.width = 2
It removes all of the newly drawn lines from the graph and I'm left with the old grid. And for some inexplicable reason, I can't get:
With TChart1
.Canvas.Brush.Style = bsSolid
.Canvas.Pen.Style = psSolid
.Canvas.Pen.Visible = True
.Canvas.Pen.Width = 2
Call .Canvas.MoveTo(TChart1.Axis.Bottom.MinXValue, 0)
Call .Canvas.LineTo(TChart1.Axis.Bottom.MaxXValue, 0)
End With
to do anything. I'm sure i'm doing something horribly wrong here. If anyone can point it out to me, I'd be greatly appreciative. All i need to do is draw dark lines at these 3 places. Any method of doing so is okay with me.