formtools / core

The Form Tools Core.
https://formtools.org
207 stars 78 forks source link

Data Visualization - Total #737

Open nelsondcosta23 opened 3 years ago

nelsondcosta23 commented 3 years ago

Hi mates, how are you?

Its been a while, as Ben its temporary away from FT. I need your help to think about a solution.

Do you have any idea how can I add total to a graph? Like the img below? image

thanks

nelsondcosta23 commented 3 years ago

Well I found out this https://stackoverflow.com/questions/47166265/label-values-and-total-in-google-visualization-stacked-bar-chart https://developers.google.com/chart/interactive/docs/gallery/columnchart

Adn i think i have to change "visualizations.class.php" file..

Any tips?

solucje commented 3 years ago

Hi I will look at that today. Stay tuned :)

nelsondcosta23 commented 3 years ago

I cant do inside FT, BUT I tried in custom made chart.

And I added

                     var view = new google.visualization.DataView(data);
view.setColumns([0, 1, {
    type: 'string',
    role: 'annotation',
    sourceColumn: 1,
    calc: 'stringify'
}]);

And change chart.draw(view, options);

And work with customcharts.. in FT i failed 👍 Hope it helps

nelsondcosta23 commented 3 years ago

I already change some charts... pie and etc... but doing this is a pain in the ass -.-'

Im pretty sure somewhere here:

<script src="https://www.gstatic.com/charts/loader.js"></script>

<div id="dv_vis_{$vis_id}_{$id_suffix}"></div>
<script>
google.charts.load('current', {'packages':['corechart']});
google.charts.setOnLoadCallback(vis_drawChart);

function vis_drawChart() {
    var data = new google.visualization.DataTable();

    data.addColumn("string", "");
    data.addColumn("number", "Entradas");
    data.addRows($num_rows);

    $js_lines_str
    chart.draw(data, settings);

}
</script>
END;
nelsondcosta23 commented 3 years ago

Hi I will look at that today. Stay tuned :)

Hi, any news?