doujiu6976 2018-08-10 09:39
浏览 151

highcharts多列图表不显示

i want to display highcharts type columns i have followed this example https://www.highcharts.com/demo/column-basic in my case data is fetched from database

var id = $("input[id='id1']:checked").val();  
                 getAjaxData(id);                
                //});
            var opt = {
                    chart: {
                        renderTo: 'container4',
                        type: 'column'
                    },
                    title: {
                        text: 'abc',
                        x: -20 //center
                    },
                    
                    xAxis: {
                        categories: []
                          
                    },
                    yAxis: {
                        title: {
                            text: 'Millions'
                        },
                        plotLines: [{
                                value: 0,
                                width: 1,
                                color: '#808080'
                            }]
                    },
                    tooltip: {
                        headerFormat: '<span style="font-size:11px">{series.name}</span><br>',
                        pointFormat: '<span style="color:{point.color}">{point.name}</span>:<b>{point.y}</b> of total<br/>'
                    },
                    plotOptions: {
                        series: {
                            borderWidth: 0,
                            dataLabels: {
                                enabled: true,
                                format: '{point.y}'
                            }
                        }
                    },
                    legend: {
                        itemStyle: {
                
                            fontSize:'10px'
                        },
                        
                        layout: 'vertical',
                        align: 'right',
                        verticalAlign: 'top',
                        
                        floating: true,
                        borderWidth: 1,
                        backgroundColor: ((Highcharts.theme && Highcharts.theme.legendBackgroundColor) || '#FFFFFF'),
                        shadow: true
                        
                    },
                    series: []
                };
                function getAjaxData(id) {
                $.getJSON("file.php", {id: id},function(json) {
                    opt.xAxis.categories = json[0]['data']; 
                    opt.series[0] = json[1];
                    opt.series[1] = json[2];
                    chart = new Highcharts.Chart(opt);
                }); 
           }            

but my char is displaying like this enter image description here

i want to display both columns. but here only one columns is displaying. other display if displayed column is switched off. is it problem with displaying or php file. if it is i will provide it also

</div>
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?
    • ¥15 求daily translation(DT)偏差订正方法的代码
    • ¥15 js调用html页面需要隐藏某个按钮
    • ¥15 ads仿真结果在圆图上是怎么读数的
    • ¥20 Cotex M3的调试和程序执行方式是什么样的?
    • ¥20 java项目连接sqlserver时报ssl相关错误
    • ¥15 一道python难题3
    • ¥15 牛顿斯科特系数表表示
    • ¥15 arduino 步进电机
    • ¥20 程序进入HardFault_Handler