gpt4 book ai didi

jquery - jqPlot - 无法将 x 轴显示为右侧图例

转载 作者:行者123 更新时间:2023-12-01 08:09:37 26 4
gpt4 key购买 nike

我使用 jqPlot 作为条形图,我想将 x 轴显示为图例。

附上截图...

enter image description here

代码:

var s1 = [2.5, 6.3, 7.4, 10]; 
var ticks = ['a', 'b', 'c', 'd'];
plot2 = $.jqplot('chart2', [s1], {
seriesDefaults: {
renderer:$.jqplot.BarRenderer, rendererOptions:{ varyBarColor : true },
pointLabels: { show: true }, showLabel: true, },
series: [ {label: 'Cups'}, {label: 'Dishes'}, ],
legend: { show: true, placement: 'outside', //rendererOptions: {numberColumns: 2} },
axes: { xaxis: { renderer: $.jqplot.CategoryAxisRenderer, ticks: ticks },
yaxis:{ tickOptions:{ formatString:'%.2f%' } } }

最佳答案

这是一个example如何做到这一点:

var s1 = [2.5, 6.3, 7.4, 10]; 
var ticks = ['a', 'b', 'c', 'd'];
plot2 = $.jqplot('chart1', [s1,[],[],[]], { //give it extra blank series
seriesDefaults: {
renderer: $.jqplot.BarRenderer,
rendererOptions: { varyBarColor : true },
pointLabels: { show: true },
showLabel: true
},
series: [ {},
{renderer: $.jqplot.LineRenderer}, // set our empty series to the lineRenderer, so the bar plot isn't padded for room
{renderer: $.jqplot.LineRenderer},
{renderer: $.jqplot.LineRenderer} ],
legend: { show: true, placement: 'outside', labels: ticks}, // give the legend the tick labels
axes: { xaxis: { renderer: $.jqplot.CategoryAxisRenderer, ticks: ticks }},
yaxis: { tickOptions:{ formatString:'%.2f%' } }
});

产品:

enter image description here

关于jquery - jqPlot - 无法将 x 轴显示为右侧图例,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14477967/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com