Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/473.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何将图表直接放置在图例上方?(高图)_Javascript_Highcharts - Fatal编程技术网

Javascript 如何将图表直接放置在图例上方?(高图)

Javascript 如何将图表直接放置在图例上方?(高图),javascript,highcharts,Javascript,Highcharts,以下是我迄今为止所取得的成就 Highcharts.chart('container'{ 图表:{ 类型:'bar' }, 标题:{ 文本:“” }, 出口:{ 已启用:false }, 学分:{ 已启用:false }, 工具提示:{ 已启用:false }, xAxis:{ 线宽:0, 标题:{ 文本:“” }, 标签:{ 已启用:false } }, 亚克斯:{ 网格线宽:0, 标题:{ 文本:“” }, 堆叠标签:{ 启用:对, 风格:{ fontWeight:'粗体', 颜色:“灰色

以下是我迄今为止所取得的成就

Highcharts.chart('container'{
图表:{
类型:'bar'
},
标题:{
文本:“”
},
出口:{
已启用:false
},
学分:{
已启用:false
},
工具提示:{
已启用:false
},
xAxis:{
线宽:0,
标题:{
文本:“”
},
标签:{
已启用:false
}
},
亚克斯:{
网格线宽:0,
标题:{
文本:“”
},
堆叠标签:{
启用:对,
风格:{
fontWeight:'粗体',
颜色:“灰色”
},
格式化程序:函数(){
返回“总计:”+this.Total;
}
},
标签:{
已启用:false
}
},
图例:{
对,,
对齐:“左”
},
打印选项:{
系列:{
堆叠:“正常”,
点宽:30,
数据标签:{
启用:对,
颜色:'白色',
风格:{
fontWeight:“无”,
尺寸:15
}
}
}
},
系列:[{
名称:'未付(到期日>7天)',
数据:[41]
}, {
名称:“未付(到期日<7天)”,
数据:[32]
}, {
名称:'逾期',
数据:[15]
}]
});

我想将条形图直接放在图例上方。还有,有没有可能在条形图前面有一条小水平线。谢谢。

查看代码中的注释

Highcharts.chart('container'{
图表:{
类型:'bar',
marginBottom:-180,//使图表显示在底部
活动:{
加载:函数(){
//画水平线
var ren=this.render,
colors=Highcharts.getOptions().colors,
直线=['M',550,0,'L',0,0,'L',0,0,'M',0,0,'L',5,0];
路径(行)
艾特先生({
“笔划宽度”:2,
笔划:颜色[1]
})
.翻译(10335)
.add();
}
}
},
标题:{
文本:“”
},
出口:{
已启用:false
},
学分:{
已启用:false
},
工具提示:{
已启用:false
},
xAxis:{
线宽:0,
标题:{
文本:“”
},
标签:{
已启用:false
}
},
亚克斯:{
网格线宽:0,
标题:{
文本:“”
},
堆叠标签:{
启用:对,
风格:{
fontWeight:'粗体',
颜色:“灰色”
},
格式化程序:函数(){
返回“总计:”+this.Total;
}
},
标签:{
已启用:false
}
},
图例:{
对,,
对齐:“左”
},
打印选项:{
系列:{
堆叠:“正常”,
点宽:30,
数据标签:{
启用:对,
颜色:'白色',
风格:{
fontWeight:“无”,
尺寸:15
}
}
}
},
系列:[{
名称:'未付(到期日>7天)',
数据:[41]
}, {
名称:“未付(到期日<7天)”,
数据:[32]
}, {
名称:'逾期',
数据:[15]
}]
});
Highcharts.chart('container', {
chart: {
    type: 'bar'
},
title: {
    text: ''
},
exporting: {
        enabled: false
},
credits: {
        enabled: false
},
tooltip: {
        enabled: false
},
xAxis: {
        lineWidth: 0,
    title: {
            text: ''
    },
    labels: {
            enabled: false
    }
},
yAxis: {
        gridLineWidth: 0,
    title: {
            text: ''
    },
    stackLabels: {
        enabled: true,
        style: {
            fontWeight: 'bold',
            color: 'gray'
        },
        formatter: function(){
                return 'Total: ' + this.total;
        }
    },
    labels: {
            enabled: false
    }
},
legend: {
    reversed: true,
    align: 'left'
},
plotOptions: {
    series: {
        stacking: 'normal',
        pointWidth: 30,
        dataLabels: {
            enabled: true,
            color: 'white',
            style: {
                    fontWeight: 'none',
                    fontSize: 15
            }
        }
    }
},
series: [{
    name: 'Outstanding (due > 7 days)',
    data: [41]
}, {
    name: 'Outstanding (due < 7 days)',
    data: [32]
}, {
    name: 'Overdue',
    data: [15]
}]
});
Highcharts.chart('container', {
    chart: {
        type: 'bar',
        marginBottom: -180, //make charts display at bottom
        events: {
            load: function () {
                // Draw the horizontal line
                var ren = this.renderer,
                    colors = Highcharts.getOptions().colors,
                    line = ['M', 550, 0, 'L', 0, 0, 'L', 0, 0, 'M', 0, 0, 'L', 5, 0];

                ren.path(line)
                    .attr({
                        'stroke-width': 2,
                        stroke: colors[1]
                    })
                    .translate(10, 335)
                    .add();

            }
        }

    },
    title: {
        text: ''
    },
    exporting: {
            enabled: false
    },
    credits: {
            enabled: false
    },
    tooltip: {
            enabled: false
    },
    xAxis: {
            lineWidth: 0,
        title: {
                text: ''
        },
        labels: {
                enabled: false
        }
    },
    yAxis: {
            gridLineWidth: 0,
        title: {
                text: ''
        },
        stackLabels: {
            enabled: true,
            style: {
                fontWeight: 'bold',
                color: 'gray'
            },
            formatter: function(){
                    return 'Total: ' + this.total;
            }
        },
        labels: {
                enabled: false
        }
    },
    legend: {
        reversed: true,
        align: 'left'
    },
    plotOptions: {
        series: {
            stacking: 'normal',
            pointWidth: 30,
            dataLabels: {
                enabled: true,
                color: 'white',
                style: {
                        fontWeight: 'none',
                        fontSize: 15
                }
            }
        }
    },
    series: [{
        name: 'Outstanding (due > 7 days)',
        data: [41]
    }, {
        name: 'Outstanding (due < 7 days)',
        data: [32]
    }, {
        name: 'Overdue',
        data: [15]
    }]
});