Google LineChart <undefined> html tag with html hint

I am using google plots in my project and I have a little problem setting up tooltips.

Try this problem: http://jsfiddle.net/nq7sk6mq/7/

I want to use HTML hints and my chart settings are:

if google
  google.load "visualization", "1.0",
    packages: ["corechart"]
    callback: ->
      data = new google.visualization.DataTable()
      data.addColumn('number', ' v1')
      data.addColumn('number', 'v2')
      data.addColumn({type:'boolean',role:'certainty'})
      data.addColumn('number', 'v3')
      data.addColumn({type:'boolean',role:'certainty'})
      data.addColumn('number', 'v4')
      data.addColumn({type:'boolean',role:'certainty'})
      data.addColumn({type: 'string', role: 'tooltip','p':{'html': 'true'}})

      

My data for him:

values.push [
          iterator, 
          values2[iterator],
          true, 
          values3[iterator], 
          true, 
          values4[iterator], 
          false,
          customTooltip()]

      

Parameters:

options = {
        legend:{position:"top"},
        vAxes: {
          0: {},
        },
        hAxis: {
          ticks: data.getDistinctValues(0)
        },
        series:{
          0: {pointSize: 5, color: "#0f8d4c"},
          1: {pointSize: 5, color: "#b74848"},
          2: {color: "#00a259", pointSize: 4}
        },

        width : width,
        tooltip: {isHtml: true}
      }

      

call draw:

google.setOnLoadCallback(drawChart(values,chartid,options))
drawChart: (data, chartid,options) ->
  chart = new google.visualization.LineChart(document.getElementById(chartid));
  chart.draw(data,options)

      

customTooltip:

customTooltip: () ->
return '<div style="padding:5px 5px 5px 5px; height:20px;">' +
  "<p>Teeest</p>"+
'</div>'

      

And I ended up in Chrome:

<div>
  <undefined class="google-visualization-tooltip" style="width: 66px; height: 20px; left: 181.5px; top: 133.5px;">
    <div style="padding:5px 5px 5px 5px; height:20px;">
      <p>Teeest</p>
    </div>
  </undefined>
</div>

      

The graphs display correctly and, if you use the normal tooltips, they also work correctly. So my question is, why am I getting this undefined tag destroying the layout of the tooltip?

I have found that I am not the only person facing this problem. http://code.google.com/p/google-visualization-api-issues/issues/detail?id=1290

+3


source to share


1 answer


According to @juvian help The problem was that the style was set inline on the cointainer div and it seems that the tooltips inherited it from the div. So the answer is to remove the style from the container div and apply it to the element you want.



0


source







All Articles