Anormal Scatter Composition

28 views
Skip to first unread message

Mauricio Rodriguez

unread,
Sep 14, 2015, 7:10:48 PM9/14/15
to Google Visualization API

Hi, I use JQuery an Ajax to compose Scatter Graph, most of times its show anormal, only few times looks well.

Other thing Material Scatter not format percents.

Whats happend?

Thanks for help!


There is my code:


        $.ajax({
            type: "GET",
            url: $("#frm").attr('action'),
            data: 'acc=des&plt=' + plt + '&crr=' + crr  + '&gen=' + gen + '&ran=' + index,
            dataType: "json",
            success: function(JSONData){

                $("#TabularDesglose").html(JSONData.html);

                // ScatterChart3

                var data = google.visualization.arrayToDataTable(JSONData.cap);

                var formatter = new google.visualization.NumberFormat({pattern: '#.##%'});
                formatter.format(data, 1); // format column 2
                formatter.format(data, 2); // format column 3

                var options = {

                    chart: {
                        title: 'Desglose',
                        subtitle: 'Avance / Promedio'
                    },
                    width: 800,
                    height: 400,

                    isStacked: true,
                    fill: 20,
                    displayExactValues: false,

                    hAxis: {title: 'Ciclos', minValue: 1, maxValue: 10, showTextEvery:1, format: '#'},
                    vAxis: [{title: 'Créditos', minValue: 0, maxValue: 1, format: 'percent'},
                            {title: 'Asignaturas', minValue: 0, maxValue: 1, format: 'percent'},
                            {title: 'Promedio', minValue: 0, maxValue: 10, format: '#'}
                    ],
                    series: {
                        0: {axis: 'Créditos'},
                        1: {axis: 'Asignaturas'},
                        2: {axis: 'Promedio'}
                    },
                    axes: {
                        y: {
                            'Creditos': {label: 'Avance'},
                            'Asignaturas': {label: 'Avance'},
                            'Promedio': {label: 'Promedio'}
                        },
                        x: {
                            'Ciclos': {label: 'Ciclos'}
                        }
                    }
                };

                var chart = new google.charts.Scatter(document.getElementById('ScatterChart3'));

                chart.draw(data, google.charts.Scatter.convertOptions(options));

                $("#filter-box2").val('').unbind();

                $("#tableFilter2").tablesorter({
                    widthFixed: false,
                    widgets: ["filter"],
                    dateFormat: "ddmmyyyy",
                    cssInfoBlock: "tablesorter-no-sort",
                    sortList: [[0]],
                    widgetOptions: {
                        filter_columnFilters: false,
                        filter_saveFilters: true,
                        resizable: false,
                        filter_external: '.search'
                    },               
                    headers: {
                        0: { sorter: true },
                        1: { sorter: true },
                        2: { sorter: false },
                        3: { sorter: false },
                        4: { sorter: false },
                        5: { sorter: false },
                        6: { sorter: false },
                        7: { sorter: false },
                        8: { sorter: false },
                        9: { sorter: false },
                        10: { sorter: false },
                        11: { sorter: false }
                    }
                });

            }

        });
       
    }

Sergey Grabkovsky

unread,
Sep 15, 2015, 10:03:20 AM9/15/15
to Google Visualization API
From the rendering errors, it looks like you're attempting to render in a div that isn't visible at render-time. As for the percent issue, you're using the wrong option for the vertical axes. You're attempting to define options for multiple axes in an option that only takes one (vAxis). You need to use the vAxes option instead.

--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-visualizati...@googlegroups.com.
To post to this group, send email to google-visua...@googlegroups.com.
Visit this group at http://groups.google.com/group/google-visualization-api.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-visualization-api/70c9a797-7718-4e89-8632-6f49926e6816%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Mauricio Rodriguez

unread,
Sep 17, 2015, 3:05:34 PM9/17/15
to Google Visualization API
Thaks Sergey!
Reply all
Reply to author
Forward
0 new messages