【问题标题】:I can not show HTML in the Google Charts tooltip我无法在 Google 图表工具提示中显示 HTML
【发布时间】:2018-03-15 18:17:39
【问题描述】:

当我想将 HTML 代码放置在工具提示中时遇到问题

有人遇到过类似的问题吗? 我留下我的code

function drawChart() {
//var data = google.visualization.arrayToDataTable(dataToHistogram(response));
var dataTable = new google.visualization.DataTable();
dataTable.addColumn({'type': 'string', 'role': 'tooltip', 'p': {'html': true}});
dataTable.addColumn({ type: 'number', id: 'precio' });


for (var i = datos.length - 1; i >= 0; i--) {
  dataTable.addRow(["<strike>"+datos[i].titulo+"</strike>", datos[i].valor]);
}


var options = {
  title: '',
  legend: { position: 'none' },
  bar: {groupWidth : 20},
  width: 1200,
  series: [
    {color: '#007d00', visibleInLegend: true}, {}, {},
  ],
  isStacked: 'absolute',
  tooltip:{isHtml: true}
};

var chart = new google.visualization.Histogram(document.getElementById('chart_div'));
chart.draw(dataTable, options);

}

我基于此

[https://developers.google.com/chart/interactive/docs/customizing_tooltip_content#using-html-tooltips][2]

【问题讨论】:

    标签: javascript charts google-visualization


    【解决方案1】:

    在文档的Supported Charts 部分中,in 表示直方图不支持 HTML 工具提示。这是报价:

    支持的图表

    目前支持 HTML 工具提示 以下图表类型:

    • 面积图
    • 条形图
    • 日历图表
    • 烛台图
    • 柱形图
    • 组合图
    • 折线图
    • 饼图
    • 桑基图
    • 散点图
    • 时间线

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-03-26
      • 2017-04-12
      • 2015-02-19
      • 1970-01-01
      • 2016-11-17
      • 1970-01-01
      • 2019-03-31
      • 1970-01-01
      相关资源
      最近更新 更多