SeriesHotSpot Tool and Page Size

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
norman
Newbie
Newbie
Posts: 82
Joined: Fri Jan 25, 2008 12:00 am

SeriesHotSpot Tool and Page Size

Post by norman » Fri Jul 24, 2009 1:27 pm

Hi,

I have a chart on which I have added a single SeriesHotspot tool in order so that I can (i) display tooltips when users hover over points and (ii) so that I can display a popup as I hover of annotations.

The code to achieve this is something like this:

Code: Select all

Dim seriesHotspotTool As New Steema.TeeChart.Tools.SeriesHotspot(ch)
With seriesHotspotTool
   .HelperScript = Steema.TeeChart.Tools.HotspotHelperScripts.Annotation
   .HotspotCanvasIndex = 499
   .MapAction = Steema.TeeChart.Styles.MapAction.Script
   .MapElements = ""
End With
AddHandler seriesHotspotTool.GetHTMLMap, AddressOf hotspot_GetHTMLMap
and

Code: Select all

Private Sub hotspot_GetHTMLMap(ByVal sender As Steema.TeeChart.Tools.SeriesHotspot, ByVal e As Steema.TeeChart.Tools.SeriesHotspotEventArgs)

   ' Point tooltips 
   Dim XVal As String = e.PointPolygon.Title
   XVal = Date.FromOADate(e.Series.XValues.Value(e.PointPolygon.ValueIndex)).ToString("dd/MM/yyyy HH:mm:ss")

   e.PointPolygon.Title = "Date/Time: " & XVal & vbCrLf & _
   "Value: " & e.Series.YValues.Value(e.PointPolygon.ValueIndex).ToString()

   ' Annotation tooltips
   If ((e.Series Is WebChart.Chart(0)) AndAlso (e.PointPolygon.ValueIndex = 0)) Then
      
      Dim mapElements As String = String.Empty
      Dim i As Integer
      Dim countOfAnnotations As Integer = annotations.Count

      For Each annotation In annotations
         If i = 0 Then
            mapElements &= ">"
         End If

         mapElements &= "<AREA shape=""Poly"" " & _
         "onmouseover=""ShowAnnotation('Annotation" & i.ToString() & "');"" " & _
         "onmouseout=""ShowAnnotation('');"" " & _
         "coords = """ & _
         annotation.Left & "," & _
         annotation.Top & "," & _
         annotation.Left + annotation.Width & "," & _
         annotation.Top & "," & _
         annotation.Left + annotation.Width & "," & _
         annotation.Top + annotation.Height & "," & _
         annotation.Left & "," & _
         annotation.Top + annotation.Height & _
         IIf(i = countOfAnnotations - 1, """", """>")
         i += 1
      Next

      If mapElements <> String.Empty Then
         CType(sender, Steema.TeeChart.Tools.SeriesHotspot).MapElements = mapElements
      End If
   End If
End Sub
I've noticed that when I have a lot of points on my chart that the tooltips for the points are contributing hugely to the size of my page, so I'd like to have the option of showing them or not. If I look at the page source in my browser it looks something like this (I've edited it for brevity):

Code: Select all

<div>
<IMG>
<MAP>
<AREA shape="Poly" onmouseover="ShowAnnotation('Annotation 1');" onmouseout="ShowAnnotation('');" coords = "238,374,260,374,260,393,238,393">
<AREA shape="Poly" onmouseover="ShowAnnotation('Annotation 2');" onmouseout="ShowAnnotation('');" coords = "264,364,284,364,284,383,264,383">
<AREA shape="Poly" Title="Date/Time: 16/02/2009 23:30:00 Value: 220" coords=" 676,194,651,194,676,194,653,194,652,195,651,196,650,195,649,194,650,193,651,192,652,193,653,194">
<AREA shape="Poly" Title="Date/Time: 16/02/2009 22:30:00 Value: 220" coords=" 651,194,626,194,651,194,628,194,627,195,626,196,625,195,624,194,625,193,626,192,627,193,628,194">
<AREA shape="Poly" Title="Date/Time: 16/02/2009 21:30:00 Value: 220" coords=" 626,194,601,194,626,194,603,194,602,195,601,196,600,195,599,194,600,193,601,192,602,193,603,194">
<AREA shape="Poly" Title="Date/Time: 16/02/2009 20:30:00 Value: 220" coords=" 601,194,575,194,601,194,577,194,576,195,575,196,574,195,573,194,574,193,575,192,576,193,577,194">
</MAP>
</div>
In the above example I only have 2 annotation hotspots (see first 2 AREA tags) and 3 point hotspots but typically there would be hundreds of points. Is there a way of keeping the annotation tooltips and not showing the tooltips over the points, in such a way that none of the output relating to the point coords are included in the page. For example is the following result possible:

Code: Select all

<div>
<IMG>
<MAP>
<AREA shape="Poly" onmouseover="ShowAnnotation('Annotation 1');" onmouseout="ShowAnnotation('');" coords = "238,374,260,374,260,393,238,393">
<AREA shape="Poly" onmouseover="ShowAnnotation('Annotation 2');" onmouseout="ShowAnnotation('');" coords = "264,364,284,364,284,383,264,383">
</MAP>
</div>
I tried commenting out the lines:

Code: Select all

Dim XVal As String = e.PointPolygon.Title
XVal = Date.FromOADate(e.Series.XValues.Value(e.PointPolygon.ValueIndex)).ToString("dd/MM/yyyy HH:mm:ss")
e.PointPolygon.Title = "Date/Time: " & XVal & vbCrLf & _
"Value: " & e.Series.YValues.Value(e.PointPolygon.ValueIndex).ToString()
but the resulting page source still included the following lines between the opening and closing MAP tags:

Code: Select all

<AREA shape="Poly" coords=" 678,194,677,195,676,196,675,195,674,194,675,193,676,192,677,193,678,194">
<AREA shape="Poly" coords=" 676,194,651,194,676,194,653,194,652,195,651,196,650,195,649,194,650,193,651,192,652,193,653,194">
<AREA shape="Poly" coords=" 651,194,626,194,651,194,628,194,627,195,626,196,625,195,624,194,625,193,626,192,627,193,628,194">
Thanks,

Norman

norman
Newbie
Newbie
Posts: 82
Joined: Fri Jan 25, 2008 12:00 am

Re: SeriesHotSpot Tool and Page Size

Post by norman » Fri Jul 24, 2009 1:47 pm

Hi,

Just found the following:

Code: Select all

e.PointPolygon.IncludePolygon = False
:oops:

Post Reply