我们的图表如下:
非常好。好吧,除了第一个和最后一个酒吧被分成两半!
我知道它为什么这样做,但我不知道如何解决它。我试过gridPadding,barPad和Pad。可能是其他人。无论出于何种原因,我似乎无法在没有预先添加和附加一些空白虚拟数据的情况下推动它们。这会在底部产生额外的两个令人困惑的条目,这绝对是不可接受的。
代码如下。
var f = [[0,1.29],[1,1.29],[2,1.48],[3,1.48],[4,1.48],[5,1.48],[6,1.48],[7,1.48]];
var v = [[0,0.71],[1,0.71],[2,0.8],[3,0.8],[4,0.8],[5,0.8],[6,0.8],[7,0.8]];
var p = [[0,-0.26],[1,-0.26],[2,0.67],[3,0.67],[4,0.67],[5,0.67],[6,0.67],[7,0.67]];
// [x position, y height]
var x_line = [[0,1],[1,21],[2,33],[3,39],[4,21],[5,21],[6,21],[7,21]];
var rank_ticks = [0,1,2,3,4,5,6,7];
$('body').on('click', '#load-fvp', function () {
var plot2 = $.jqplot('fvp-chart', [f, v, p, x_line], {
stackSeries: true,
gridPadding: 40,
highlighter: {
show: true,
tooltipAxes: 'y',
useAxesFormatters: false,
formatString: "<span style='display: none;'>%s</span> %s" // hide the first S because it's irrelevant
},
seriesDefaults: {
renderer: $.jqplot.BarRenderer,
rendererOptions: {
barWidth: 24,
shadowAlpha: 0.03,
fillToZero: true,
highlightMouseOver: false
},
pointLabels: {
show: true,
stackedValue: true
}
},
legend: {
show: true,
location: 'nw',
labels: ['Fund.', 'Value', 'Price', 'Rank']
},
series: [
{showLabel: true, useNegativeColors: false},
{showLabel: true, useNegativeColors: false},
{showLabel: true, useNegativeColors: false},
{
disableStack : true,//otherwise it wil be added to values of previous series
renderer: $.jqplot.LineRenderer,
lineWidth: 2,
pointLabels: {
show: false
},
color: '#FF7D7D',
markerOptions: {
size: 5, color: 'red'
},
xaxis: 'x2axis', yaxis: 'y2axis',
}
//, color: '#FFCC66', useNegativeColors: false, shadow: false, fill: false, lineWidth: 3, fillToZero: true
],
axesDefaults: {
//tickRenderer: $.jqplot.CanvasAxisTickRenderer,
},
axes: {
xaxis: {
ticks: rank_ticks,
tickOptions: {
formatString:'%d',
fontSize:'7pt',
fontFamily:'\"Lucida Grande\",Verdana, Georgia, Times, serif',
},
},
x2axis: {
ticks: rank_ticks,
showTicks: false
},
yaxis: {
labelRenderer: $.jqplot.CanvasAxisLabelRenderer,
ticks: [-4, -3, -2, -1, 0, 1, 2, 3, 4],
label: "Information Ratio",
labelOptions: {
angle: 270,
fontFamily: "Verdana, Helvetica",
fontSize: "13pt",
textColor: '#111'
},
tickOptions: {
formatString:'%d',
fontSize:'7pt',
fontFamily:'\"Lucida Grande\",Verdana, Georgia, Times, serif',
},
},
y2axis: {
labelRenderer: $.jqplot.CanvasAxisLabelRenderer,
ticks: [100, 50, 1],
showLabel: true,
label: "Rank",
labelOptions: {
angle: 90,
fontFamily: "Verdana, Helvetica",
fontSize: "13pt",
textColor: '#FF7D7D'
},
tickOptions: {
formatString:'%d',
fontSize:'7pt',
fontFamily:'\"Lucida Grande\",Verdana, Georgia, Times, serif',
},
}
}});
$('.jqplot-table-legend').css('left', '567px').css('top', '-14px');
});
答案 0 :(得分:0)
尝试以下值:
gridPadding:{
right:40,
left:40
}