Home Forums Chart Support CanvasJS with flask

CanvasJS with flask

Viewing 2 posts - 1 through 2 (of 2 total)
  • #34200

    I have seen in other forums that we can use only numbers or date-time in axis, in the bar graph as in the image below. May I know if Bar chart the feature is limited to that or we can use strings(like labels) in X-axis?

    #34226

    @shravya,

    In dataPoints, the x value can either be numeric or DateTime object. If you want to show a string as the X-axis label, you can use the label property.

    Kindly take a look at this code-snippet for an example,

    data: [{
      type: "column",
      dataPoints: [
          { label: "One", y: 71 },
          { label: "Two", y: 55 },
          { label: "Three", y: 50 },
          { label: "Four", y: 65 },
        ]
    }]

    Also, take a look at this JSFiddle for an example on column chart with labels.

    column chart with labels

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.