在 canvas.js 气泡图上加载文本内容值

Load text content values on canvas.js bubble chart

我正在尝试制作一个使用字符串数据的气泡图来进行说明。我所做的是:

var chart = new CanvasJS.Chart("chartContainer",
{
zoomEnabled: true,
  title:{
   text: "Day at a Glance"
  },
  axisX: {
    title:"Airline",

  },
  axisY: {
    title:"Terminal"
  },

  legend:{
    verticalAlign: "bottom",
    horizontalAlign: "left"

  },
  data: [
  {
    type: "bubble",
    xValueType: "dateTime",
 dataPoints: [
// { x: 64.8, y: 2.66, z:12074.4 , name: "India"},
 { x: "H", y: "American Airlines", z:"3", name: "American Airlines"}
 ]
   }
   ]

 });

但是 canvas.js 似乎不允许在 x 和 y 数据点上使用字符串。我已经尝试过使用名称,但它不起作用。我该怎么做才能使我的气泡图在 x 轴和 y 轴上显示字符串值?

在 axisX 上,您可以使用 label instead of x. Y axis requires a number though - without which chart won't know where to render the bubble. In case you have other text to be displayed, consider showing them inside toolTip 或 indexLabel 来显示文本。