<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Custom line chart visual tooltip in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Custom-line-chart-visual-tooltip/m-p/1388407#M25821</link>
    <description>&lt;P&gt;Hi &lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/260277"&gt;@humppa123&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;For a line (and presuming your data points are bound to the individual points in your line function), you need to resolve the mouse position and work out the nearest data point to supply to the tooltip handler.&lt;/P&gt;
&lt;P&gt;For the vertical line, you need to draw it in the DOM, spanning the entirety of the value axis and keep it hidden until you resolve the point above. When you have this, you move the line to the resolved data point's position and then show it. You might want a similar approach for any series in your visual (in mine I've done this with a circle and move this to the same horizontal position as my line when using the mouse).&lt;/P&gt;
&lt;P&gt;I've done something similar to the core line chart in one of my visuals - if you start with &lt;A href="https://github.com/dm-p/powerbi-visuals-smlc/blob/master/src/dom/ChartHelper.ts#L485" target="_self"&gt;&lt;FONT face="courier new,courier"&gt;bindTooltipEvents()&lt;/FONT&gt;&lt;/A&gt;, you can follow the code to the other function calls. The most relevant is &lt;A href="https://github.com/dm-p/powerbi-visuals-smlc/blob/c3f21eab932bbbb9dc39df9018fcca1c60f7f776/src/dom/ChartHelper.ts#L589" target="_self"&gt;&lt;FONT face="courier new,courier"&gt;getHighlightedDataPoints()&lt;/FONT&gt;&lt;/A&gt; , which handles the resolution of data points, depending on whether you're using a linear or categorical axis.&lt;/P&gt;
&lt;P&gt;Hopefully this should help you get started. Good luck!&lt;/P&gt;
&lt;P&gt;Daniel&lt;/P&gt;
&lt;DIV id="kpm-root" class="kpm_LTR notranslate" translate="no"&gt;&amp;nbsp;&lt;/DIV&gt;</description>
    <pubDate>Tue, 22 Sep 2020 21:11:28 GMT</pubDate>
    <dc:creator>dm-p</dc:creator>
    <dc:date>2020-09-22T21:11:28Z</dc:date>
    <item>
      <title>Custom line chart visual tooltip</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Custom-line-chart-visual-tooltip/m-p/1387403#M25816</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've succesfully created a custom line chart visual. Now I want it to have the same tooltip functionality as the default line chart. But I've ran into two issues:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;The tooltip returns the whole series in the getTooltipData() method. How can I query for a single datapoint in the addTooltip() when using a line generator and a path?&lt;/LI&gt;&lt;LI&gt;How can I display a vertical bar at the current tool tip position just like in the built in visual?&lt;/LI&gt;&lt;/OL&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Best regards&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Sep 2020 13:26:28 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Custom-line-chart-visual-tooltip/m-p/1387403#M25816</guid>
      <dc:creator>humppa123</dc:creator>
      <dc:date>2020-09-22T13:26:28Z</dc:date>
    </item>
    <item>
      <title>Re: Custom line chart visual tooltip</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Custom-line-chart-visual-tooltip/m-p/1388407#M25821</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/260277"&gt;@humppa123&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;For a line (and presuming your data points are bound to the individual points in your line function), you need to resolve the mouse position and work out the nearest data point to supply to the tooltip handler.&lt;/P&gt;
&lt;P&gt;For the vertical line, you need to draw it in the DOM, spanning the entirety of the value axis and keep it hidden until you resolve the point above. When you have this, you move the line to the resolved data point's position and then show it. You might want a similar approach for any series in your visual (in mine I've done this with a circle and move this to the same horizontal position as my line when using the mouse).&lt;/P&gt;
&lt;P&gt;I've done something similar to the core line chart in one of my visuals - if you start with &lt;A href="https://github.com/dm-p/powerbi-visuals-smlc/blob/master/src/dom/ChartHelper.ts#L485" target="_self"&gt;&lt;FONT face="courier new,courier"&gt;bindTooltipEvents()&lt;/FONT&gt;&lt;/A&gt;, you can follow the code to the other function calls. The most relevant is &lt;A href="https://github.com/dm-p/powerbi-visuals-smlc/blob/c3f21eab932bbbb9dc39df9018fcca1c60f7f776/src/dom/ChartHelper.ts#L589" target="_self"&gt;&lt;FONT face="courier new,courier"&gt;getHighlightedDataPoints()&lt;/FONT&gt;&lt;/A&gt; , which handles the resolution of data points, depending on whether you're using a linear or categorical axis.&lt;/P&gt;
&lt;P&gt;Hopefully this should help you get started. Good luck!&lt;/P&gt;
&lt;P&gt;Daniel&lt;/P&gt;
&lt;DIV id="kpm-root" class="kpm_LTR notranslate" translate="no"&gt;&amp;nbsp;&lt;/DIV&gt;</description>
      <pubDate>Tue, 22 Sep 2020 21:11:28 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Custom-line-chart-visual-tooltip/m-p/1388407#M25821</guid>
      <dc:creator>dm-p</dc:creator>
      <dc:date>2020-09-22T21:11:28Z</dc:date>
    </item>
  </channel>
</rss>

