0
我使用的是使用line-chart.min.js和d3.v2.js插件的n3圖表。我想隱藏x軸0刻度值和最後一個孩子刻度值。如何在下面的圖片中完成。 如何隱藏n3圖表中的第一個孩子和最後一個孩子的刻度
請,有人能幫我解決這個問題,我不想APR11和最後一跳值會動態變化。
app.directive('barChart', [
function() {
return {
restrict: 'EA',
template: '<linechart data="data" options="options" width="550" height="291"></linechart>',
scope: {
range: '=',
},
link: function(scope, elements, attrs){
scope.$watch("range", function() {
var values = scope.range;
scope.data = values;
scope.options = {
yaxis : {name: "Calories",labelalign:"-135"},
stacks: [{axis: "y", series: ["firstVal", "secondVal", 'thirdVal']}],
fonts: {family: 'serif', size: '14px'},
axes: {
x: {key: 'x', type: 'date',labelFunction: function(x) { return d3.time.format('%b %d')(new Date(x));}},
y: {key :'y',type: 'linear',min:0}
},
transition: {ease: 'elastic', duration: 1000, delay: 100},
series: [
{id: 'secondVal', y: 'secondVal', axis: 'y', color: "#b3d660", type: 'column', drawDots: true, dotSize: 4, label: 'Labe1'},
{id: 'firstVal', y: 'firstVal', axis: 'y', color: "#ff8669", thickness: '2px', type: 'column', label: 'Label2'},
{id: 'thirdVal', y: 'thirdVal', axis: 'y', color: "#52c4dc", type: 'column', dotSize: 2, label: 'Label3'}
],
lineMode: 'linear',
tension: 0.2,
tooltip: {
mode: 'scrubber', formatter: function (x, y, series) {
return series.label + ', ' + Math.round(y);
}
},
drawLegend: true,
drawDots: true,
columnsHGap: 5
}
});
}
};}]);
請添加一些代碼。 – lin