带有Dygraphs的堆积图

时间:2017-02-10 10:27:39

标签: dygraphs stacked

我正在尝试使用" stackedGraph:true"创建带有Dygraphs的堆叠图形。 当我将数据硬复制到html文件时,一切都很好: EXP:

    var gStacked = new Dygraph(
        document.getElementById("Stacked"),
    "X,Y,Z\n"+ 
      "1,3,5\n"+ 
      "2,5,4\n"+ 
      "3,2,7\n",
        {
            title: "Stacked",
            xlabel: 'Date/Time',
            ylabel: 'Messages',
            stackedGraph: true,
            drawCallback: function(g, is_initial) {
                if (!is_initial) return;
                        showHideSeries(9);
             },
        });

当我尝试从csv文件中读取数据时,stackedGraph无法正常工作 EXP:

    var gStacked = new Dygraph(
        document.getElementById("Stacked"),
    "Read.csv", // path to CSV file 
        {
            title: "Stacked",
            xlabel: 'Date/Time',
            ylabel: 'Messages',
            stackedGraph: true,
            drawCallback: function(g, is_initial) {
                if (!is_initial) return;
                        showHideSeries(9);
             },
        });

有什么想法吗? 提前致谢

1 个答案:

答案 0 :(得分:1)

问题是一个带有commonOptions的var,其中stackGraphs为false。当我评论这个时,一切都很好。