Page 1 of 1

To change Visible or invisible induvidual datapoint set

Posted: Thu Feb 22, 2007 9:17 am
by 9523665
Dear Steema Team,

Is there any solution to hide a set of datapoint in line graph from 1000's of data set?
Eg. TChart.Item(0).Series(0).Value(0).Visible = false.

As the "Steema Team" suggested to use "OnGetSeriesPointerStyle" event, I tried but it work only with point graph not with line Graph.
If there is no solution for the same, I would like to request "Steema Team" to introduce the feature with next release, since its very necessary for regular use and its very advantage for clients.


Thanks in advance
Ajith

Posted: Thu Feb 22, 2007 9:35 am
by narcis
Hi Ajith,

You can easily achieve that setting those points to null:

Code: Select all

Private Sub Form_Load()
    TChart1.Series(0).FillSampleValues 100
    
    For i = 40 To 60
        TChart1.Series(0).SetNull i
    Next
End Sub

Posted: Thu Feb 22, 2007 10:04 am
by 9523665
hi Narcís,

Thanks for the quick reply.

What about if I want to use the same data while I am zooming?

B Regards
Ajith

Posted: Thu Feb 22, 2007 10:19 am
by 9523665
hi Narcís,

I checked the code provided by you. There is a problem in it. you will find a gap in between the lines which was set null.
My requirement is to set invisible a purticular set of datapoints when I have thousands of datapoint set and when the user zoom's I want to show the hidden data.

B Regards
Ajith

Posted: Thu Feb 22, 2007 10:28 am
by narcis
Hi Ajith,

Basically, what SetNull does is setting a point's color to clNone. To achieve what you request you can do something like this:

Code: Select all

Private Sub Form_Load()
    TChart1.Series(0).FillSampleValues 100
    
    For i = 40 To 60
        TChart1.Series(0).SetNull i
    Next
End Sub

Private Sub TChart1_OnZoom()
    For i = 0 To TChart1.Series(0).Count - 1
        If (TChart1.Series(0).IsNull(i)) Then
            TChart1.Series(0).PointColor(i) = clTeeColor
        End If
    Next i
End Sub

Private Sub TChart1_OnUndoZoom()
    For i = 40 To 60
        TChart1.Series(0).SetNull i
    Next
End Sub

Posted: Thu Feb 22, 2007 10:58 am
by 9523665
hi Narcís,

I tried with the example provided by you. Its setting null. But if I set null from 10 to 20, 9 and 21 is joining together. I could see a gap in between.

B Regards
Ajith

Posted: Thu Feb 22, 2007 11:23 am
by narcis
Hi Ajith,

This doesn't happen for me here using TeeChart Pro v7.0.1.3 ActiveX, which is the latest version available at the client area. Which TeeChart version are you using?

Posted: Thu Feb 22, 2007 11:48 am
by 9523665
hi Narcís,

Right now I am using TeeChart Pro v7.0.0.7. I will try to install newest version. If you have link for download pls give me the URL.

Thanks in advance
Ajith

Posted: Thu Feb 22, 2007 12:45 pm
by 9523665
hi Narcís,


I tried with version "TeeChart Pro v7.0.1.3 ActiveX". It does'nt change. With Line graph it shows the gap after setting null and with FastLine graph, nothing is changing. Can I send the sample file towards you?

B Regards
Ajith

Posted: Thu Feb 22, 2007 3:45 pm
by narcis
Hi Ajith,

Please post your project at our upload page.

Thanks in advance.

Posted: Thu Feb 22, 2007 3:51 pm
by 9523665
hi Narcís,

I uploaded the file.

B Regards
Ajith

Posted: Thu Feb 22, 2007 4:20 pm
by narcis
Hi Ajith,

Thanks for the project, I run this on my machine and behaves similar to the code I pasted. I'm afraid I don't understand which is the exact problem you are having. Could you please give us more information about the issue?

Thanks in advance.

Posted: Thu Feb 22, 2007 4:38 pm
by 9523665
hi Narcís,

I will upload JPEG file which is generated in my system. You can see a circle, which is graph missing part after I set null. For me, I would like to have the data points join from 10 to 40 after nullifying the datapoint sets between 10 and 40.

B Regards
Ajith

Posted: Thu Feb 22, 2007 6:05 pm
by narcis
Hi Ajith,

Thanks for the image.

You can achieve what you request doing something like this:

Code: Select all

Private Sub Form_Load()
    Dim StartIndex, EndIndex As Integer
    
    With TChart1.Series(0)
    
         .FillSampleValues 100
        
         For i = 40 To 60
             .SetNull i
         Next
         
         StartIndex = -1
         
         For i = 0 To .Count - 1
             If .IsNull(i) Then
                 If StartIndex = -1 Then
                     StartIndex = i
                 Else
                     EndIndex = i
                 End If
             End If
         Next
         
         TChart1.AddSeries scLine
         TChart1.Series(1).Color = .Color
         
         Dim c As Integer
         c = 0
         
         While c <= .Count - 1
            If c <> StartIndex - 1 Then
                TChart1.Series(1).AddXY c, .YValues.Value(c), "", clTeeColor
                c = c + 1
            Else
                TChart1.Series(1).AddXY StartIndex - 1, .YValues.Value(StartIndex - 1), "", clTeeColor
                TChart1.Series(1).AddXY EndIndex + 1, .YValues.Value(EndIndex + 1), "", clTeeColor
                c = EndIndex + 2
            End If
         Wend
     
    End With
    
    TChart1.RemoveSeries (0)
    
End Sub