• Resolved benspr

    (@benspr)


    Hi, is there a recommendation for a visualization tool to use to output some very simple bar charts based on calculated output? I’d love to see a plugin that would work to add charts to this.

Viewing 1 replies (of 1 total)
  • Plugin Author codepeople

    (@codepeople)

    Hello @benspr,

    In reality you don’t need another plugin to display the data with a bar chart, however, you will need some programming skills.

    For example, inserting a “HTML Content” field in the form with the piece of code below as its content, you will have a bar chart in the form:

    <canvas id="myChart" width="400" height="400"></canvas>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.6.0/Chart.bundle.min.js"></script>
    <script>
    fbuilderjQuery(window).on('load',
    function(){
    var ctx = document.getElementById("myChart").getContext('2d');
    var myChart = new Chart(ctx, {
        type: 'bar',
        data: {
            labels: ["Red", "Blue", "Yellow", "Green", "Purple", "Orange"],
            datasets: [{
                label: '# of Votes',
                data: [12, 19, 3, 5, 2, 3],
                backgroundColor: [
                    'rgba(255, 99, 132, 0.2)',
                    'rgba(54, 162, 235, 0.2)',
                    'rgba(255, 206, 86, 0.2)',
                    'rgba(75, 192, 192, 0.2)',
                    'rgba(153, 102, 255, 0.2)',
                    'rgba(255, 159, 64, 0.2)'
                ],
                borderColor: [
                    'rgba(255,99,132,1)',
                    'rgba(54, 162, 235, 1)',
                    'rgba(255, 206, 86, 1)',
                    'rgba(75, 192, 192, 1)',
                    'rgba(153, 102, 255, 1)',
                    'rgba(255, 159, 64, 1)'
                ],
                borderWidth: 1
            }]
        },
        options: {
            scales: {
                yAxes: [{
                    ticks: {
                        beginAtZero:true
                    }
                }]
            }
        }
    });
    });
    </script>
    

    Of course it is only an example, you should read the documentation for using the ChartJS library visiting its official website:

    https://www.chartjs.org/

    and generate the bar chart dynamically from the equations.

    Best regards.

Viewing 1 replies (of 1 total)
  • The topic ‘Outputting charts from data’ is closed to new replies.