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.
For example:
Apple| Oranges| WaterMelon | Bittermelon | Cucumbers | Lotus Root
Fruits | Vegetables
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']
}
}
}
});
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.