How to configure chart.js line chart with very low minimum height, and only 0 and 1 (no decimals) as ticks on the y-axis - layout

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?

Related

Excel Chart Scatter Straight Line and show length based on 3rd series

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.

flot: zero values are displayed on the axis

One of my line charts contain values in the range 0..11.5
flot is using yaxis with 0..12
the problem: value 0 is drawn on the axis (see attached image)
Is there a way to tell flot to add a small margin, e.g. use 0.5 margin?
or - Is there a way to get the min and max values, so I manually can set xmin and xmax?
There is the autoscaleMargin option for the axis which does what you want. Or you can set min and max values for the axis manually.
The default for autoscaleMargin on the y-axis is 0.02 (you can see that the points are not completely on the axis but slighty above). Increase this to your liking.

Flot xaxis ticks exceeds the specified number

I'm new to Flot, so my understanding of ticks is the number of columns that flot will draw on the chart.
As my labels are quite long, having 6 ticks fits nicely. But most times, it just exceeds the number I set, and that screws up the labels.
I assume this has to do with Flot's algorithm? Is there any way I can fix it to 6 columns?
A simplet of how I set it.
xaxis: { mode: 'time', timeformat: "%y/%m/%d %H:%M:%S", tick:6 },
The ticks option is a guideline. Flot tries to match that value, but its first priority is to choose 'round' values, i.e. 5:00 instead of 5:01.
There are several ways to work around this, depending on your data. The guaranteed solution is to calculate your six tick values manually, and provide them to Flot in the 'ticks' array option. Besides that, you may be able to coax Flot into generating the correct number of ticks by adjusting the minTickSize and axis min/max.

Which is the best way to plot graph in iphone?

I saw some Core-plot sample. Is there anything equivalent that will do my task easily? I also want to know feasibility with Core-plot in iPhone. (any issues with core-plot)
I want to have multi-colored vertical bar chart. Is it possible to customize Core-plot framework. Using only one barplot can we have multiple segment on it.
Thank you.
Naveen Thunga
To make a stacked bar plot, you need to make multiple plots, one for each segment. On all but the bottom plot, set barBasesVary to YES. The datasource will ask for a third field called CPTBarPlotFieldBarBase which is the base value for the bar. You will have to do the stacking calculations yourself.
The horizontal lines can be drawn using an additional bar plot. Give the bars a short height (tip - base). You can make the width wider than the others if you want--each plot is independent.
The space between the bars depends on several factors. By default, bar widths are specified in data coordinates. For example, if the bar locations are one unit apart, a bar width of 0.5 will make the bar width and the space between the bars equal; a bar width of 0.75 will make the space 1/3 of the bar width. The actual width in pixels depends on the size of the graph and how many bars are visible (determined by the plot range along that axis). If barWidthsAreInViewCoordinates is YES, then bar widths are given in pixels which keeps them the same apparent width as the plot range changes, but the space between them will change with the plot range.

Partially missing gridlines on log-scale charts in Excel 2007

I'm using Excel 2007 to create a log-scale chart of numbers (specifically the Zimbabwean dollar exchange rate) over time. I'm using an x-y scatterplot and noticing one odd quirk.
The range of y values (numbers) spans a factor of about 10^30. On every chart I make using this data, half the gridlines are missing. Specifically, only the gridlines corresponding to the largest values show up. In fact, regardless of the total range only the top factor of 10^13 or so have gridlines. This is not dependent on the log base.
Am I doing something wrong? Is this a known bug? I can't find any references to this issue on google or microsoft's bug reports.
Silly work around as well, but if you are going to be presenting your graph in Powerpoint, you can make the background color of the graph "no fill" and then when you paste it into Powerpoint (I paste it as a PDF). You can draw grid lines and match them up with the ticks on the y-axis. Arrange your graph "bring to front" when you are finished drawing so that the lines won't appear in front of your data. You can group it all to make sure the lines don't shift while making your presentation and so that they re-size properly if you re-size your graph.
I'm having the same problem, it's definitely a bug.
Try a sequence 1, 10, 100, 1e+12, 1e+30 vs 0..4 and plot x,y scatter, and clearly the scale grid is messed-up even in linear, and in log is the behaviour you described.
My workaround was to make a transformation of the values and depict them scaled down (by a Million factor). That way the data the graph is handling is never above 10e9 (the value I started to hit issues).
So, my suggestion is: graph a Log version of the data (and clearly make a legend for it)
I was able to replicate your problem and come up with a pseudo-workaround.
The formatting goes a bit funny, but all the lines show up if you right-click on the axis, select Format Axis. Under the Axis Options, there is a Horizontal Axis Crosses setting. Changing it from Automatic to Maximum Axis Value causes all the gridlines to appear.
Ran into same thing: Will not show log grid lines for y-axis ranging below 1e-7. Have need for dynamic range of 1e5 down to 1e-15. Tagging auto or max will show grid, but puts axis labels in non-useful place for display.
My workaround: used Open Office to get what I needed. Could not find useful solution in Excel 2010.

Resources