一个或多个参与者未能绘制() [英] One or more participants failed to draw()

查看:109
本文介绍了一个或多个参与者未能绘制()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



一个或多个参与者未能绘制()×
这是我的代码,我希望有一个combort与dashbord,但我有这个错误: janv。 2013janv。 2013févr。 2013févr。 2013年3月2013年2013年。 2013avr。 2013年4月2013年3月2013年6月2013年。 2013juil。 2013年至2013年度2013年






 !功能($){


google.load('visualization','1.1',{packages:['corechart']});
google.load('visualization','1',{packages:['controls']});
google.setOnLoadCallback(initialize);



函数初始化(cityName){

//您可以操作变量响应
//成功!
var query = new google.visualization.Query('http://api.XXX.com/XXX/datasource?table=montmorin');


query.setQuery(select(cost_reportings_timestamp),sum(cost_reportings_cost)group by(cost_reportings_timestamp)pivot ecoadmin_zone_name);
//使用回调函数发送查询。
query.send(drawDashboard);
//console.log(response);


函数drawDashboard(response){
//包含类似这样的内容来捕获错误是个好主意

if(response.isError ()){
alert('Error in query:'+ response.getMessage()+''+ response.getDetailedMessage());
return;
}

var data = response.getDataTable();
console.log(data);
var namePicker = new google.visualization.ControlWrapper({
controlType:'ChartRangeFilter',
containerId:'filter_div',

options:{
//过滤日期轴
filterColumnLabel:'cost_reportings_timestamp',
ui:{
chartType:'LineChart',
chartOptions:{
chartArea:{
width:'90%'
},
hAxis:{
baselineColor:'none'
}
},
//显示显示股票收盘价的单个系列
//因此,该视图有两列:日期(轴)和股票价值(线系列)
chartView:{
列:[0,1]
}
}
},
//初始范围:2010至2021
州:{
范围:{
start:new Date(2012),
end:new Date(2019)
}
}
})

//定义条形图
var pieChart = new google.visualization.ChartWrapper({
chartType:'ComboChart',
containerId:'chart_div' ,

选项:{
width:400,
height:300,
seriesType:'bars',
isStacked:'True',
hAxis:{
minValue:0,
maxV alue:60
},
chartArea:{
top:0,
right:0,
bottom:0
},
} ,
view:{columns:[0,1,2,3]}
});

var dashboard = new google.visualization.Dashboard(document.getElementById('dashboard_div'))。
绑定(namePicker,pieChart)。
draw(data);

}
}(jQuery);

你能否解释我??????



,这是我的JSON格式:

  google.visualization.Query.setResponse({version: 0.6, 状态: OK, SIG: 266867977, 表:{ COLS:[{ ID: ec​​oadmin_building_name, 标签: ec​​oadmin_building_name, 类型 : 字符串, 图案: },{ ID: ec​​oadmin_zone_name, 标签: ec​​oadmin_zone_name, 类型: 串, 图案: },{ ID : cost_reportings_cost, 标签: cost_reportings_cost, 类型: 号码, 图案: },{ ID: cost_reportings_timestamp, 标签: cost_reportings_timestamp, 类型: date,pattern:}],rows:[{c:[{v:Mairie de Montmorin},{v: ,{v:0.0},{v:new Date(2012,11,8)}]},{c:[{v:Mairie de Montmorin},{v: Bureau de M. le Maire},{v:0.0},{v:new Date(2012,11,9)}]},{c:[{v:Mairie de Montmorin},{v:Bureau de M. le Maire},{v:0.453663},{v:new Date(2012,11,10)}]},{c: [{v:Mairie de Montmorin},{v:M. de Mair局e},{v:0.458649},{v:new Date(2012,11,11)}]},{c:[{v:Mairie de Montmorin},{ v:Bureau de M. le Maire},{v:0.44573},{v:new Date(2012,11,12)}]},{c:[{v Mairie de Montmorin},{v:Bureau de M. le Maire},{v:1.09863},{v:new Date(2012,11,13)}]},{ c:[{v:Mairie de Montmorin},{v:Maire de Maire},{v:0.429977},{v:new Date ,14)}]},{c:[{v:Mairie de Montmorin},{v:Maire de Maire},{v:1.13331E-4} ,{v:new Date(2012,11,15)}]},{c:[{v:Mairie de Montmorin},{v },{v:0.0},{v:new Date(2012,11,16)}]},{c:[{v:Mairie de Montmorin},{ :Bureau de M. le Maire},{v:0.471569},{v:new Date(2012,11,17)}]} 





解决方案

您的JSON问题是没有'table' JSON表示中的属性,'cols''rows''版本'的直接同伴。因此,您的固定JSON应如下所示:

  google.visualization.Query.setResponse({
version: 0.6,
status:ok,
sig:266867977,
cols:[{
id:ecoadmin_building_name,
label:ecoadmin_building_name,
type:string,
pattern:
},{
id: ecoadmin_zone_name,
label:ecoadmin_zone_name,
type:string,
pattern:
},{
id :cost_reportings_cost,
label:cost_reportings_cost,
type:number,
pattern:
},{
id:cost_reportings_timestamp,
label:cost_reportings_timestamp,
type:date,
pattern:
}
$ brows:[
{c:[{v:Mairie de Montmorin},{v:Maire de Maire), {v:0.0},{v:new Date(2012,11,8)}]},
{c:[{v:Mairie de Montmorin},{v:Bureau de M. le Maire},{v:0.0},{v:new Date(2012,11,9)}]},
{c:[{v:Mairie de Montmorin},{v:Ma de de Maire},{v:0.453663},{v:new Date ,11,10)}]},
{c:[{v:Mairie de Montmorin},{v:Maire局},{v :{v:Mairie de Montmorin},{v: Bureau de M. le Maire},{v:0.44573},{v:new Date(2012,11,12)}]},
{c:[{v: Mairie de Montmorin},{v:Bureau de M. le Maire},{v:1.09863},{v:new Date(2012,11,13)}],
{c:[{v:Mairie de Montmorin},{v:Maire de Maire},{v:0.429977},{v:new Date (2012,11,14)}]},
{c:[{v:Mairie de Montmorin},{v:Maire局},{ v:1.13331E-4},{v:new Date(2012,11,15)}]},
{c:[{v:Mairie de Montmorin},{ v:Bureau de M. le Maire},{v:0.0},{v:new Date(2012,11,16)}]},
{c:[ { v:Mairie de Montmorin},{v:Bureau de M. le Maire},{v:0.471569},{v:new Date(2012,11,17)}] }
]
});


this is my code i want to have one combochart with dashbord but i have this error :

One or more participants failed to draw()× janv. 2013janv. 2013févr. 2013févr. 2013mars 2013mars 2013avr. 2013avr. 2013mai 2013mai 2013juin 2013juin 2013juil. 2013juil. 2013août 2013août 2013


!function($) {


    google.load('visualization', '1.1', {packages: ['corechart']});
    google.load('visualization', '1', {packages: ['controls']});
    google.setOnLoadCallback(initialize);



       function initialize(cityName) {

            // You can manipulate the variable response
            // Success! 
            var query = new google.visualization.Query('http://api.XXX.com/XXX/datasource?table=montmorin');


            query.setQuery("select (cost_reportings_timestamp), sum (cost_reportings_cost) group by (cost_reportings_timestamp)  pivot ecoadmin_zone_name");
              //Send the query with a callback function.
            query.send(drawDashboard);
        //console.log(response);
        }

       function drawDashboard(response) {
            // it's a good idea to include something like this to catch errors

            if (response.isError()) {
                alert('Error in query: ' + response.getMessage() + ' ' + response.getDetailedMessage());
                return;
            }

            var data = response.getDataTable();
            console.log(data);
            var namePicker= new google.visualization.ControlWrapper({
                controlType: 'ChartRangeFilter',
                containerId: 'filter_div',

                options: {
                    // Filter by the date axis.
                    filterColumnLabel: 'cost_reportings_timestamp',
                    ui: {
                        chartType: 'LineChart',
                        chartOptions: {
                            chartArea: {
                                width: '90%'
                            },
                            hAxis: {
                                baselineColor: 'none'
                            }
                        },
                        // Display a single series that shows the closing value of the stock.
                        // Thus, this view has two columns: the date (axis) and the stock value (line series).
                        chartView: {
                            columns: [0,1]
                        }
                    }
                },
                //Initial range: 2010 to 2021
                state: {
                    range: {
                        start: new Date(2012),
                        end: new Date(2019)
                    }
                }
            })

         // Define a bar chart
            var pieChart = new google.visualization.ChartWrapper({
                chartType: 'ComboChart',
                containerId: 'chart_div',

                options: {
                    width: 400,
                    height: 300,
                    seriesType: 'bars',
                    isStacked:'True',
                    hAxis: {
                        minValue: 0,
                        maxValue: 60
                    },
                    chartArea: {
                        top: 0,
                        right: 0,
                        bottom: 0
                    },
                },
                view: {columns: [0, 1, 2, 3]}
            });

            var dashboard = new google.visualization.Dashboard(document.getElementById('dashboard_div')).
            bind(namePicker, pieChart).
            draw(data);

       }         
}(jQuery);

could you explain me ??????

and this is the format of my JSON :

google.visualization.Query.setResponse({"version":"0.6","status":"ok","sig":"266867977","table":{"cols":[{"id":"ecoadmin_building_name","label":"ecoadmin_building_name","type":"string","pattern":""},{"id":"ecoadmin_zone_name","label":"ecoadmin_zone_name","type":"string","pattern":""},{"id":"cost_reportings_cost","label":"cost_reportings_cost","type":"number","pattern":""},{"id":"cost_reportings_timestamp","label":"cost_reportings_timestamp","type":"date","pattern":""}],"rows":[{"c":[{"v":"Mairie de Montmorin"},{"v":"Bureau de M. le Maire"},{"v":0.0},{"v":new Date(2012,11,8)}]},{"c":[{"v":"Mairie de Montmorin"},{"v":"Bureau de M. le Maire"},{"v":0.0},{"v":new Date(2012,11,9)}]},{"c":[{"v":"Mairie de Montmorin"},{"v":"Bureau de M. le Maire"},{"v":0.453663},{"v":new Date(2012,11,10)}]},{"c":[{"v":"Mairie de Montmorin"},{"v":"Bureau de M. le Maire"},{"v":0.458649},{"v":new Date(2012,11,11)}]},{"c":[{"v":"Mairie de Montmorin"},{"v":"Bureau de M. le Maire"},{"v":0.44573},{"v":new Date(2012,11,12)}]},{"c":[{"v":"Mairie de Montmorin"},{"v":"Bureau de M. le Maire"},{"v":1.09863},{"v":new Date(2012,11,13)}]},{"c":[{"v":"Mairie de Montmorin"},{"v":"Bureau de M. le Maire"},{"v":0.429977},{"v":new Date(2012,11,14)}]},{"c":[{"v":"Mairie de Montmorin"},{"v":"Bureau de M. le Maire"},{"v":1.13331E-4},{"v":new Date(2012,11,15)}]},{"c":[{"v":"Mairie de Montmorin"},{"v":"Bureau de M. le Maire"},{"v":0.0},{"v":new Date(2012,11,16)}]},{"c":[{"v":"Mairie de Montmorin"},{"v":"Bureau de M. le Maire"},{"v":0.471569},{"v":new Date(2012,11,17)}]}


解决方案

The problem with your JSON is that there is no 'table' property in the JSON representation, 'cols' and 'rows' are direct peers of 'version'. So your fixed JSON should look as follows:

google.visualization.Query.setResponse({
  "version": "0.6",
  "status": "ok",
  "sig": "266867977",
  "cols": [{
      "id": "ecoadmin_building_name",
      "label": "ecoadmin_building_name",
      "type": "string",
      "pattern": ""
    }, {
      "id": "ecoadmin_zone_name",
      "label": "ecoadmin_zone_name",
      "type": "string",
      "pattern": ""
    }, {
      "id": "cost_reportings_cost",
      "label": "cost_reportings_cost",
      "type": "number",
      "pattern": ""
    }, {
      "id": "cost_reportings_timestamp",
      "label": "cost_reportings_timestamp",
      "type": "date",
      "pattern": ""
    }
  ],
  "rows": [
    {"c": [{"v": "Mairie de Montmorin"}, {"v": "Bureau de M. le Maire"}, {"v": 0.0}, {"v": new Date(2012, 11, 8)}]},
    {"c": [{"v": "Mairie de Montmorin"}, {"v": "Bureau de M. le Maire"}, {"v": 0.0}, {"v": new Date(2012, 11, 9)}]},
    {"c": [{"v": "Mairie de Montmorin"}, {"v": "Bureau de M. le Maire"}, {"v": 0.453663}, {"v": new Date(2012, 11, 10)}]},
    {"c": [{"v": "Mairie de Montmorin"}, {"v": "Bureau de M. le Maire"}, {"v": 0.458649}, {"v": new Date(2012, 11, 11)}]},
    {"c": [{"v": "Mairie de Montmorin"}, {"v": "Bureau de M. le Maire"}, {"v": 0.44573}, {"v": new Date(2012, 11, 12)}]},
    {"c": [{"v": "Mairie de Montmorin"}, {"v": "Bureau de M. le Maire"}, {"v": 1.09863}, {"v": new Date(2012, 11, 13)}]},
    {"c": [{"v": "Mairie de Montmorin"}, {"v": "Bureau de M. le Maire"}, {"v": 0.429977}, {"v": new Date(2012, 11, 14)}]},
    {"c": [{"v": "Mairie de Montmorin"}, {"v": "Bureau de M. le Maire"}, {"v": 1.13331E-4}, {"v": new Date(2012, 11, 15)}]},
    {"c": [{"v": "Mairie de Montmorin"}, {"v": "Bureau de M. le Maire"}, {"v": 0.0}, {"v": new Date(2012, 11, 16)}]},
    {"c": [{"v": "Mairie de Montmorin"}, {"v": "Bureau de M. le Maire"}, {"v": 0.471569}, {"v": new Date(2012, 11, 17)}]}
  ]
});

这篇关于一个或多个参与者未能绘制()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆