Работя върху начертаването на някои данни за продажбите. Трябва да начертая графиката на тази екранна снимка:.
Успях да завърша толкова:
Кодът на jquery за това е:
plot = $.jqplot('SalesChart2',
[
[[1,5]],
[[1,10]],
[[1,15]],
[[1,20]],
[[2,-25]],
[[3,10]],
[[4,10]],
[[5, 6]]
]
, {
// Tell the plot to stack the bars.
stackSeries: true,
series: [
{ label: 'Cash' },
{ label: 'CreditCard' },
{ label: 'DebitCard' },
{ label: 'StoreCredit' },
{ label: 'Discount' },
{ label: 'AverageTransaction', xaxis: 'xaxis', yaxis: 'y2axis', disableStack: true },
{ xaxis: 'xaxis', yaxis: 'y2axis', label: 'ItemsPerTransaction', disableStack: true },
{ xaxis: 'xaxis', yaxis: 'y2axis', label: 'CustomerCount', disableStack: true }
],
animate: !$.jqplot.use_excanvas,
seriesDefaults: {
renderer: $.jqplot.BarRenderer,
rendererOptions: {
highlightMouseDown: true,
barWidth: 50
},
pointLabels: { show: true }
},
axes: {
xaxis: {
renderer: $.jqplot.CategoryAxisRenderer,
ticks: [1,2,3,4,5]
},
yaxis: {
min: -25,
tickOptions: {
formatString: "$%'d"
}
},
y2axis: {
autoscale: true,
min: 0
}
},
legend: {
show: true,
location: 'e',
placement: 'outside'
},
grid: {
drawGridlines: false
}
});
Но изглежда, че пропускам нещо в документацията на jqplot.
Първо, ако има отрицателни стойности на оста на оста y, положителните също започват от най-отрицателната точка на оста y.
Второ, последната серия - „Броят на клиентите“ върви далеч напред по оста x и се вижда, когато премахна ограниченията за ширина на контейнера DIV.
Може ли някой орган да ми помогне в това?