jquery/javascript/unix绘图,x轴上的子类别 [英] jquery/javascript/unix graphing, sub categories on x axis
本文介绍了jquery/javascript/unix绘图,x轴上的子类别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想知道我可以使用哪种工具/软件包来创建可以在x轴上放置多个子类别的图形.这与excel图形中的功能非常相似.
I was wondering what tool/package I can use to create a graph that can put multiple sub categories on x axis. This is very similar to a feature in excel graphs.
例如:
Apple| Oranges| WaterMelon | Bittermelon | Cucumbers | Lotus Root
Fruits | Vegetables
推荐答案
jqPlot 是一个可以进行分组的jQuery插件.
jqPlot is a jQuery plugin that can do grouping.
此代码将生成以下图像:
This code will generate the following image:
$(document).ready(function(){
$.jqplot.config.enablePlugins = true;
var line1 = [20, 10, 20, 30, 40, 50];
var xticks = ['Apples', 'Oranges', 'Watermelons', 'Bittermelon', 'Cucumbers', 'Lotus Root'];
var plot1 = $.jqplot('chart1', [line1], {
seriesDefaults:{
renderer:$.jqplot.BarRenderer,
rendererOptions: {
groups: 2,
}
},
axes:{
xaxis:{
renderer:$.jqplot.CategoryAxisRenderer,
ticks: xticks,
rendererOptions: {
groupLabels:['Fruits', 'Vegetables']
}
}
}
});
});
这篇关于jquery/javascript/unix绘图,x轴上的子类别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文