【问题标题】:Cross Browser Almende Timeline跨浏览器阿尔门德时间线
【发布时间】:2014-08-06 11:14:40
【问题描述】:

我有一个 chap-links-library almende 时间线版本在 Google Chrome 中工作,但在 Firefox 中查看时。我得到的是一个跨底轴的未定义的 NaN。好像它没有读取我在 javascript 中设置的日期。

website link

关于如何调试的任何提示。

截图如下:

还有我的主 .js 文件的 sn-p:

var timeline;
var data;
google.load("visualization", "1");
google.setOnLoadCallback(drawVisualization);

var container = $('#mytimeline');

/* GENERAL FUNCTIONS START */
function dateTimeSplit(date){ //Get individual elements of date from string "11 March, 2013"
    var jDate = new Date(date); 

    var newdate = {
        month: jDate.getMonth(),
        day: jDate.getDate(),
        year: jDate.getFullYear()
    }
    return newdate;
}

function drawVisualization(){

    var debug = 0;
    data = new google.visualization.DataTable();
    data.addColumn('datetime', 'start');
    data.addColumn('datetime', 'end');
    data.addColumn('string', 'content');
    data.addColumn('string', 'id');

    var options = {
        "width":  "100%",
        "height": "auto",
        "min-height": "400px",
        "editable": false,
        "style": "box",            
        "zoomMin": 1000 * 60 * 60 * 24,        
        "zoomMax": 1000 * 60 * 60 * 24 * 31 * 12
    };

    timeline = new links.Timeline(document.getElementById('mytimeline'));

    if(subgoals.length != 0){
        $.each(subgoals, function(index, value, tess) {
            //console.log('ID: ' + value.id + ' Start: ' + value.start + ' End: ' + value.end + ' Name: ' + value.name);
            start = dateTimeSplit(value.start);
            end = dateTimeSplit(value.end);
            data.addRows([[new Date(start.year,start.month,start.day), new Date(end.year,end.month,end.day), value.name + owner, value.id]]);
        });
    }

    //DRAW TIMELINE
    timeline.draw(data, options);

}
/* GENERAL FUNCTIONS END */

container.show();

谢谢

【问题讨论】:

    标签: javascript jquery google-visualization timeline chap-links-library


    【解决方案1】:

    经过数小时的调试,一切都取决于将日期时间传递到时间线的格式。

    I used this source to change the format

    现在我的时间线适用于 Firefox、IE、Chrome 和 Safari。

    希望这对将来的某人有所帮助!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-10-26
      • 1970-01-01
      • 2011-11-24
      • 2015-06-07
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多