Flot bar charts: configure extent of x-axis when there's only one entry?

You can set the Min and Max using an AJAX call or jQuery. Set the Min and Max to one month less and/or one month greater to avoid the bar filling the entire chart area.

– David Thomas Dec 5 '10 at 18:55 Partly both. You can set the Min and Max using an AJAX call. However, AP257 does not appear to be setting his data via AJAX, which would leave him setting Min/Max via jQuery.

Edited my answer by request. – DarrellNorton Dec 6 '10 at 10:16 It still looks like crap if you do that, but I'm wondering what ideal behaviour would be if you have a 1200px wide graph with one data point... – Ryley Jan 25 at 22:48 @Ryley: yes, I understand your issue. You could use jQuery to set the width of the Flot div if that was the case.

– DarrellNorton Jan 28 at 14:06.

Ok, change of tack. As you are working with whole day data (apparently) rather than a continuous 'analogue' series I would suggest making this explicit eg... Example here var options = { xaxis: { mode: "time", timeformat: "%y-%b", minTickSize: 1, "day", //we are only working to a resolution of 1 day autoscaleMargin: 0.02 //autoscaleMargin solves the issue of bars extending the full width }, yaxis: { tickFormatter: suffixFormatter }, legend: { position: "nw", }, colors: "#830242", grid: { hoverable: true, clickable: true } }; var data = { points: { show: true }, lines: { show: false, fill: 0 }, bars: { show: true, barWidth: 24 * 60 * 60 * 1000 //Force the bar to a day-wide (in milliseconds) }, data: new Date('2010-04-08T00:00:00Z'), 216359.0 } .

Looks great, and works as you add data too... – Ryley Jan 28 at 18:21 @Ryley Cool, shame that AP257 isn't here. Maybe they've already sussed it out. Can't nudge poeple on SO!

– El Ronnoco Jan 31 at 22:38 Don't worry, @AP257 will notice eventually, people don't like leaving un-accepted questions.... – Ryley Feb 1 at 0:24.

I'm afraid I'm not very familiar with flot but consulting the API it appears to be possible to configure bar width and alignment. Presumably it is also possible to configure the overall width of the chart. So for example, if your chart is 500px wide, setting bars as follows: bars: { barWidth: 250, align: "center", horizontal: false } should position the single bar in the middle of the x-axis.

– El Ronnoco Jan 26 at 10:25 No, but I tested it on the OPs page because I wanted to see if it would work... I do some dev with flot and this could come up for me... – Ryley Jan 26 at 18:59.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions