This topic contains 3 replies, has 2 voices, and was last updated by Sean Sean 1 year, 8 months ago.

How to initialize eChart Bar chart with parameters


  • XanaduDev
    Participant

    Posts: 19
    Member Reply #6639

    Hi,

    I’m using metronic v4.5.6 admin_1 layout and was trying out eCharts (charts_echarts.html->echarts_bar). I used amChart earlier and I can do this in another JSP page: ChartsAmcharts.initBAR(param1, param2, etc..);

    I want to do the same with eCharts. How to do that? Basically I want to to initialize a bar chart with several parameters such as categories, data and legend – all are JSON formatted Strings.

    Thanks.

    Sean
    Sean
    Keymaster

    Posts: 4206
    Support Staff Reply #6655

    Hi,

    Can you please explain your issue ? Are you getting any JS error when you tried to run your code ? Or you need help where to put your code to execute it ? If possible please provide us a test link to your developing site in a private reply so we can check your code further.

    Thanks.


    XanaduDev
    Participant

    Posts: 19
    Member Reply #6678

    Hi,

    Maybe I’ll rephrase the question.

    I want to import charts-echarts.js from a JSP page and would like to pass parameters derived from that JSP page. How would I pass the parameters to the JS file and initialize the eChart?

    Thanks.

    Sean
    Sean
    Keymaster

    Posts: 4206
    Support Staff Reply #6692

    Hi,

    You can pass it through JSON. You will need to fetch the data in JSP and just place it as a javascript variable(e.g: json); You can declare the javascript variable in HTML’s script tag so the chart initializaiton code from javascript file can access it globally.

    Thanks.

You must be logged in to reply to this topic.