Load text content values on canvas.js bubble chart

355 views Asked by At

I'm trying to make a bubble chart that uses string data for me to illustrate. What I do is the following:

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"}
 ]
   }
   ]

 });

But it seems that canvas.js does not allow string to be used on the x and y datapoint. I've already tried using name but it does not work. What could I do so that My bubble chart will show string values on the x and y axis?

1

There are 1 answers

1
Sunil Urs On BEST ANSWER

On axisX you can show text by using 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 or indexLabel.