I am using flot library to design stacked bar graph, wherein I am using following js files.
<script src="@Url.Content("~/Scripts/charts/excanvas.js")"></script>
<script src="@Url.Content("~/Scripts/charts/jquery.flot.js")"></script>
<script src="@Url.Content("~/Scripts/charts/jquery.flot.symbol.js")"></script>
With the following script I am defining my bar chart with rotated text of xaxis label by -90 degree.
$.each(data, function (index, item) {
i = (index + 1) * 2;
DataValues.push({ data: [i, item.Value], color: Color[i] });
DataValues.push([i, item.Value]);
TickData.push([i, item.MonthName]);
});
$.plot($("#CurrentYearlyTrendsBar"), [{ data: DataValues, color: "#3D69AA" }],
{
series: { bars: { show: true } },
bars: {
barWidth: 1.5,
align: "center"
},
xaxis: {
ticks: TickData,
axisLabelUseCanvas: true,
labelAngle: -90,
},
yaxis: { axisLabelUseCanvas: true },
grid: { hoverable: true }
});
$("#CurrentYearlyTrendsBar").UseTooltip();
The problem I am having is with positioning of xaxis labels. xaxis labels are positioned to the left edge of respective bar in chart.
Please suggest me how can I center align the xaxis labels to the respective bars. Thanks in Advance...
axis label
in your graph.Those are tick labels. I dont see any optionlabelAngle: -90
in flot API.are you sure about it? Please check my ans if it makes any sense to you. – Brodsky