Page 1 of 1

Saving and restoring Color Lines

Posted: Mon Aug 16, 2004 10:05 am
by 9080930
Hello,

I have created an application where by whenever it loads up, it recreates my chart and provides functionality to add or delete Color Lines.

I would like to know how I can save the position of the lines that I have drawn such that when my application loads up the next time round, I can re-add the lines in exactly the same position and length.

I was thinking of using the technique below to store the line information

Code: Select all

ProfileWrite SettingsFileName, "ColorLine1", "Color", ColorValue
ProfileWrite SettingsFileName, "ColorLine1", "Position", PositionValue
Would the PositionValue be the following Color Line property that I need to store?

Code: Select all

TChart1.Tools.Items(0).asColorLine.Value

Is this the correct way of implementing this or is there an easier way of doing it?

Many Thanks,
Reza.

Posted: Mon Aug 16, 2004 12:40 pm
by Chris
Hi --
Is this the correct way of implementing this or is there an easier way of doing it?
You could using TeeChart's native templates (*.tee) files to store the information for you, e.g.

Code: Select all

Private Sub Command1_Click()
Dim Stream
Stream = TChart1.Export.asNative.SaveToStream(True)
TChart2.Import.LoadFromStream Stream
End Sub

Private Sub Form_Load()
With TChart1
    .AddSeries scLine
    .Series(0).FillSampleValues 20
   
    .Tools.Add tcColorLine
    .Tools.Items(0).asColorLine.Axis = .Axis.Bottom
    .Tools.Items(0).asColorLine.Value = 10
    .Tools.Items(0).asColorLine.Pen.Color = vbCyan
End With
End Sub