I’ve used over the years 4D transformation tags (4DTEXT, 4DEVAL etc) to 
transfer data from 4D database to web server pages. Recently using 4D Lightning 
I had great success creating graphs by using $4DEVAL in javascript like this:

<script type="text/javascript">
// JavaScript Gender

// Load the Visualization API and the piechart package.
      google.charts.load('current', {'packages':['corechart']});

      // Set a callback to run when the Google Visualization API is loaded.
      google.charts.setOnLoadCallback(drawChartGenCan);
      google.charts.setOnLoadCallback(drawChartGenNonCan);
      

      // Callback that creates and populates a data table,
      // instantiates the pie chart, passes in the data and
      // draws it.
      
      function drawChartGenCan() {

                            // Create our data table.
                            data = new google.visualization.DataTable();
                            data.addColumn('string', 'Gender');
                            data.addColumn('number', 'Patients');
                            data.addRows([
                          ['Female', $4DEval(nb_allPat_Female)],
                            ['Male', $4DEval(nb_allPat_Male)]
                            ]);
        

                            // Set chart options
                            var options = {'title':'Gender Distribution',
                                'is3D': true,
                                'width':400,
                                'height':300,
                                'colors':['#e0440e', '#ec8f6e']
                            };

        // Instantiate and draw our chart, passing in some options.
        chart = new 
google.visualization.PieChart(document.getElementById('chart_GenCan'));
        chart.draw(data, options);
      } ………etc

but none of this works in creating Google Charts in a Web Area. There is an old 
2013 Note from a presentation on doing this but it is not specific enough to be 
much help

The manual says "When this property is checked, a special JavaScript object 
($4d) is instantiated in the Web area, which you can use to manage calls to 4D 
project methods.” - but doesn’t really provide much else as how one uses it.

Does anyone use something like Google Charts and have a 4D method example  with 
$4d that collects data for a chart drawn by a script  and an example of the 
script that they could share?

Thanks



**********************************************************************
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**********************************************************************

Reply via email to