2014-05-01 71 views
4

我有這個jsfiddle:http://jsfiddle.net/Ra2xS/38/。我已經做了很少的嘗試來定製工具提示,所以我可以隱藏工具提示中的一些數據屬性,但完全失敗。dimplejs線系列工具提示定製

任何人都可以請幫我隱藏行系列工具提示中的「日期」嗎?

var dim = {"width":590,"height":450}; //chart container width 
var data = [{"date":"01-02-2010","cost":"11.415679194952766"},{"date":"01-03-2010","cost":"10.81875691467018"},{"date":"01-04-2010","cost":"12.710197879070897"}]; 


function barplot(id,dim,data) 
{ 
    keys = Object.keys(data[0]); 
    var xcord = keys[0]; 
    var ycord = keys[1]; 
    var svg = dimple.newSvg(id, dim.width, dim.height); 
    var parser = d3.time.format("%d-%m-%Y") 
    var dateReader = function (d) { return parser.parse(d[xcord]); } 
    var start = d3.time.month.offset(d3.min(data, dateReader), -1); 
    var end = d3.time.month.offset(d3.max(data, dateReader), 1); 

    var myChart = new dimple.chart(svg,data); 
    myChart.setBounds(60, 30, 505, 305);   

    //var x = myChart.addCategoryAxis("x", xcord); 
    var x = myChart.addTimeAxis("x", xcord, "%d-%m-%Y","%b %Y"); 
    x.overrideMin = start; 
    x.overrideMax = end; 
    x.addOrderRule(xcord); 
    x.showGridlines = true; 
    x.timePeriod = d3.time.months; 
    x.floatingBarWidth = 100; 

    var y = myChart.addMeasureAxis("y", ycord); 
    y.showGridlines = true; 
    y.tickFormat = ',.1f';  

    var s1 = myChart.addSeries(null, dimple.plot.bar); 
    var s2 = myChart.addSeries(null, dimple.plot.line); 
    s2.lineWeight = 3; 
    s2.lineMarkers = true; 

    var s3 = myChart.addSeries("Price Break", dimple.plot.line); 
    s3.data = [ 
     { "Price Break" : "high", "cost" : 12.71, "date" : parser(start) }, 
     { "Price Break" : "high", "cost" : 12.71, "date" : parser(end) }, 
     { "Price Break" : "avg", "cost" : 11.65, "date" : parser(start) }, 
     { "Price Break" : "avg", "cost" : 11.65, "date" : parser(end) }, 
     { "Price Break" : "low", "cost" : 10.82, "date" : parser(start) }, 
     { "Price Break" : "low", "cost" : 10.82, "date" : parser(end) } 
    ]; 

    myChart.draw(1500); 

} 

barplot("body",dim,data); 

回答