I have a chart, that displays bars which represent rainfall in 24h. Now the first problem I had, was the default 1px width for bars in flot, see this example:
I searched for a solution and found that specifing barwidth like this:
bars: {
show: true,
barWidth : 60*60*1000 //1h
}
solves the problem. Now that actually works, but with one bad result. On my example (chart that displays 24 rainfall discretly every one hour) now this happens:
As you can see from first example, where bars are 1px width, the time goes from 13:00 previous day to 13:00 next day. Now when bar width are fixed, the time goes from 13:00 to 14:00 for some reason. Now I have tried diffrent barWidth setting, for example 50*60*1000, but that does not scale right plus the margin starts to appear beetwen each bars.
Now I would like to know how to fix this issue, that the timeline would go as in first example and the bars would have 1 hour width?
The problem was in filling data with php to flot graphs. I overlooked the wrong suming of data and then had a condition, which added to php array the time. So at the end it added extra 1 hour. So the barWidth : 60*60*1000 in my case was the right thing to go.
Well, the chart x-axis is being drawn in such a way so that, if there were any bar to show at 13:00 (the maximum value), it would be able to show it. This isn't really a Flot thing, it's just a consequence of having wider bars. If you want it to actually not go that far, you could use the "min" and "max" options on the x-axis to set this. However, if you did that, and there was any data at the final 13:00 to show, it would not be able to show it (because with the wider bar there isn't enough room).
Related
I'm trying to create a scatter straight line chart to visually show how a retaining wall looks in elevation view. I have a top of wall dimension and bottom of wall dimension and the length of each wall section. I am able to use the top and bottom of wall dimension but having trouble showing the length of the run. I have tried to add the wall length as another data point, but doesn't work, it just skews the other two points. Tried to use a cumulative run length, helper column, but couldn't get that value to populate the x axis properly. I added some notes in red in the image below. Spent a few hours and appreciate any help.
I perhaps wouldn't use excel for diagramming this, but I think you would need to add more points and interpolate the values. If your minimum wall length is 25, then you could use 25 as your base. Wall 1 is 100, so you need 4 points (100 / 25). Wall 3 is 150 so you need 6 points. Plus 1 point for each wall to accommodate start/stop.
For missing values in wall 1 top, you would take (230-224.3)/4 = 1.425. Then add 1.425 to the value above it.
It would look something like this:
And this would need to be a line chart, where column A can represent the X-axis for labeling.
How do I get the chart pictured below to use labels 1000, 6000, 11000, and so on on the X-axis, rather than 1001, 6001, 11001 and so on? This is a general question not specific to this chart. I've experienced this problem with any single chart I created over the last 20 years.
It didn't bother me a lot before, but now that I am working on producing high quality visualizations, it has become an eyesore big enough to bother me. I hope there is a simple workaround.
Excel chart:
Simply select the respective axis -> right-click -> Format Axis...
Then adjust the bounds as required to e.g., Minimum: 1,000 and Maximum: 6,000, and the Major units to 5,000 (step-size). You could also change the Minor units but you do not use tick marks anyways. In effect, adjusting these parameters you can adjust the format of the axis to exactly fit you needs.
EDIT: Further explanation based on the comment
You need to explicitly select the x-axis by clicking on it so that it is highlighted as shown below (not the yellow part of course):
If this does not work, you can also select the x-axis in the following way; assuming you are able to adjust the y-axis as mentioned in your comment. Select the y-axis -> right click -> Format Axis....
Inside Format Axis you need to select Axis Options and select Horizontal (Value) Axis:
I'm trying to tailor the chart above to take up as little vertical space as possible. It is a line chart showing binary data (1 or 0 for door open or closed), but it seems to force me to have the decimal ticks between the two values, even thought every point's y-axis value is 1 or 0 as integers. Ideally it would be no taller than the width of the y-axis label.
Is this possible? I've tried various things to do with the container, removing y-axis ticks etc, but I'm struggling to get it more compact than this.
UPDATE:
I've managed to get rid of the decimal ticks with config from these docs. Still no luck on the height...is there an undocumented minimum or something?
Per this question, the answer is to set a fixed height on the chart canvas.
Fix the height of Y-Axis of Bar chart in chart.js?
The blue bar indicates how much something should be, the orange bar shows how much there actually is. The difference in number is only 7 however the chart makes it look like the difference is more than 1/2. How can I change this to the bar chart looks more accurate to a difference of 7 and not 1/2.
Double click on y axis. The format axis tab will appear and in the axis options change the minimum limit to zero.
Please look at the image below: How can orange bar in the first chart be that big. This pattern repeats even if I make both values half like 105, 21 or 53, 10 etc.
As soon as value is value is 43 the chart starts behaving fine.
Thanks.
Excel is changing the axis (that you don't have displayed) automatically to what it thinks is a relevant range. However, this range is probably something like 75% to 100% as in the following picture (with the axis displayed):
While this seems to not make sense for the purpose of a 100% stacked bar chart, this is nonetheless what Excel tries to do.
To fix it, go to Primary Horizontal Axis options and change the Minimum from "Auto" to "Fixed" and set the value to 0. You might also want to set the Maximum to "Fixed" and set the value to 1. See options pictured below:
Excel seems to start doing its auto axis adjustment once one of the numbers is less than about 20% of the other number.