Home Forums Chart Support How to get graph type after chart is rendered

How to get graph type after chart is rendered

Viewing 8 posts - 1 through 8 (of 8 total)
  • #11589

    Is it possible to get the current type of graph after the graph is created using jquery

    #11590

    Yes, to get the chart type of first dataSeries use
    $("#chartContainer").CanvasJSChart().options.data[0].type.

    Source: jQuery Integration Overview

    #11591

    Thank you
    I tried this code but it shows an error message ‘undefined is not a function’

    • This reply was modified 7 years, 8 months ago by Akhil H.
    #11592

    I used chrome devtools console and came to know that CanvasJSChart() function is not available.

    #11593

    Without looking into code it’s hard to guess the issue. Can you please create a jsfiddle?

    #11595
    #11596

    [update]

    We have just released v1.9.6 Beta with Methods & Properties, which allows you to export chart as image, print chart, programmatically access internally calculated values, etc. Please refer to the release blog for more information.

    In canvasjs.min.js or canvasjs.js all chart initialized variables can be reffered using chart.options. So, here you can use chart.options.data[0].type to get assigned chart type of first dataSeries.

    Source: https://canvasjs.com/docs/charts/basics-of-creating-html5-chart/updating-chart-options/

    #11597

    Thanks a lot
    It worked fine…..

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

You must be logged in to reply to this topic.