javascript - 如何使用 Highchart.js 创建带有累积线的堆积图

标签 javascript asp.net-mvc charts highcharts

有人有使用 Highchart 实现如图所示结果的示例吗?

function drawChart(result) {
    var response =
        {
            Month: result.Month,
            Data: result.Data,
            Title: result.title
        };
    $('#dvChart').highcharts({
        chart: {
            type: 'column'
        },
        title: {
            text: title
        },

        xAxis: {
            categories: response.Month
        },
        yAxis: [{
            min: 0,
            title: {
                text: "# Of Tests"
            },

        }, 

        ],

        plotOptions: {
            column: {
                pointPadding: 0.2,
                borderWidth: 0,
                stacking: 'normal',

                }
            }
        }

        ,    
        series:                 
             response.Data                                       
    });

}

我上面的代码可以实现堆积图,但我不知道如何将累积线放入图表中。

Stacked chart with cumulative lines

最佳答案

要获得具有堆叠系列的line类型系列,您应该为具有除chart.type选项中定义的类型之外的其他类型的系列设置每个系列的类型类型。

示例:http://jsfiddle.net/t3v579uj/

$(function () {
    $('#container').highcharts({
        chart: {
            type: 'column'
        },
        xAxis: {
            categories: ['r', 'e', 's', 'p', 'o']
        },
        yAxis: [{
            min: 0,
            title: {
                text: "# Of Tests"
            }
        }],
        plotOptions: {
            column: {
                pointPadding: 0.2,
                borderWidth: 0,
                stacking: 'normal'
            }
        },
        series: [{
            data: [1,2,3,4]
        },{
            data: [1,2,3,4]
        },{
            data: [1,2,3,4]
        },{
            type: 'line',
            data: [2,3,4,5]
        }]
    });
});

关于javascript - 如何使用 Highchart.js 创建带有累积线的堆积图,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32877546/

相关文章:

asp.net-mvc - ASP.NET MVC + FluentValidation + PartialView > 无客户端验证

c# - 在 View 中访问 session 变量

jquery - 这是有效的 jquery getJSON 调用吗?

R Plotly : How to set the color of Individual Bars of a Waterfall Chart in R Plot. ly?

reporting-services - 瀑布 - PowerBI 中的自定义排序?

javascript - 重置缩放: only updates on pan?

javascript - 将纯文本呈现为 HTML 维护空白——没有 <pre>

mysql - 如何优化一个月前的星期几、一天中的时间的数据聚合

javascript - 每 15 秒加载完所有内容后刷新页面

javascript - Typescript 2 无法解析外部 Node 模块