labels centered between ticks in a gauge - highcharts

I have made a windgauge with a beaufort scale (see http://meteo-alkmaar.dyndns.org/sl/af.html ).
Is there a way to center the labels between the ticks.(the green scale)
Thanks
Theo

Related

Point selection in pictures with custom scale

I try to analyze images with Fiji. Therefore I first “calibrate” the scale with set scale run(“Set Scale…”, “distance=52.6 known=30 pixel=1 unit=no global”); and then make a rectangle as seen in the picture: Pic 1. Then I execute a measurement with run(“Measure”); and try to make a point at the centre of the rectangle with makePoint(XPos, YPos, “small yellow hybrid”); as shown here: Pic 2.
XPos and YPos refer to the measured center coordinates of the rectangle. However the point is totally misplaced. I saw that the point is placed based on the pixels in the brackets and not based on my scale as seen in the second picture. Does anyone understand this behaviour, and how to help it?
Full Code:
run("Set Measurements...", "area centroid fit display redirect=None decimal=3");
run("Measure");
XPos=getResult("X", nResults-1);
YPos=getResult("Y", nResults-1);
print("Point placed at X "+XPos+" and Y "+YPos+".");
makePoint(XPos, YPos, "small yellow hybrid");
Would be happy if you could help me.
Best Max
Answer from biovoxxel on forum.image.sc
You can try the following after running the measurement. waitForUser("make a rectangular selection"); getSelectionBounds(x, y, width, height); makePoint(x+width/2, y+height/2); This is independent of the Results table and should produce the correct point position.

How to reset a Rectangle's x,y,width,height, after transform

I have an app that uses konvajs, where I set rectangles to be resizable. I have it set such that after I transform the rectangle I set the scaleX and scaleY to 1 so I can just use x, y, width, and height. I do this with the following code:
myRectangle.on('transformend', function() {
myRectangle.width(Math.round(myRectangle.width() * myRectangle.scaleX()));
myRectangle.height(Math.round(myRectangle.height() * myRectangle.scaleY()));
myRectangle.scaleX(1);
myRectangle.scaleY(1);
});
However, sometimes after I resize (usually if I "flip" the rectangle by dragging up or to the left), the x, y, width and height are strange values. Sometimes the width or height is negative, sometimes it seems like the x and y positions do not refer to the top left of the rectangle. I want to be able to extract information about the rectangle, so I would like position to be top left of the rectangle with positive width and height values. I don't mind resetting these values after the rectangle is tranformed, but I am not quite sure how konvajs is calculating the x,y,width, and height so I can't properly reset them. Is there some metric indicating when a tranform "flips" a rectangle? Or some other way to reset it?
It seems that setting flipEnabled and rotationEnabled to false on the transformer prevents rotations from happening.
To get a visual sense of what is happening to the attrs during the transform, take a look at the demo in the official docs here and pay special attention to width/height, rotation and scale as you resize by dragging the right edge first, then repeat with the bottom edge.
It will help to understand that dragging a Transformer handle changes the scale of the rectangle - not the width or height. However this is not the end of the story - if you 'flip' the shape in the horizontal axis then you will see that the rotation is changed from zero to 180 degrees and the scaleX remains positive. But if you drag and flip the shape in the vertical axis then there is no rotation effect and the scaleY switches to negative.
Long story short - at the moment I can't think of a useful use-case that requires trying to redraw the rectangle without scale or rotation affects, which I will refer to as the 'plain' rect versus the 'exotic' rect you get after using the Transformer.
If the use-case is hit detection via your own math then you have everything you need to know in the rects x & y, width & height, rotation and scaleX & scaleY. Even if you could get the attrs for a plain rect you would still have the same params to plug into your math, so recomputing the plain rect is wasted effort.
If the use-case is storage (serialization) of the rect's attrs then again the same point as above - you need to store the position, rotation, size, and scale so as to be able to redraw it later.
A legitimate use-case for resetting scale to 1 would be if your app's business case requires it. But this only covers resetting:
rect.seAttrs({
width: rect.width() * scaleX,
height: rect.height() * scaleY,
scaleX: 1,
scaleY: 1
}
and leaves the rect at the same position and rotation.
Conclusion: attempting to recompute a plain rect from an exotic rect may not be worth the effort in some cases.

In Geogebra, can you plot the abscissa (xAxis) vertically and the ordinate (yAxis) horizontally?

In GeoGebra, can you plot the abscissa (xAxis) vertically and the ordinate (yAxis) horizontally?
I need this, since I like to visualise an inverse. Since I also like to visualise an Area between different values, I need an IntegralBetween for an interval on y's (so re-interpreting x as y does not work). In addition the function is very tall, so I like to have the layout rotated by 90 degrees.
In GeoGebra's 2D view x always refers to the horizontal and y to the vertical axes. You can however shade the area between two functions in y using inequalities with zero line thickness

Alpha value of 3d chart's rotation ? where is the center?

My chart:
http://jsfiddle.net/gh/get/jquery/1.9.1/highslide-software/highcharts.com/tree/master/samples/highcharts/demo/3d-scatter-draggable/
beta:
I think that the value "beta" of 3d draggable scatter chart, is at half of xAxis (so at the half of "max-width")..
alpha:
but alpha ? where is the center of rotation for Alpha ?
I ask you this, because i would like to add an image that rotates together the chart, when i rotate the chart.
And to transform the image i must to know many things as Alpha and beta...
Thanks!
The beta/alpha are rotation angles by x / y axis.
Docs:
http://api.highcharts.com/highcharts#chart.options3d.alpha
http://api.highcharts.com/highcharts#chart.options3d.beta

How to determine/calculate where the Y axis tick marks are being plotted in CorePlot?

I'm working with CorePlot to generate a bar graph with horizontal bars (CPTXYGraph and CPTBarPlot).
There are only 10 bars being plotted at any given time, but the labels for them are arbitrarily long. As a result of that the Y axis labels rotation is set to 0.5. For the longest labels there are clipping issues with the label going outside of the left and/or bottom of the plot area.
I've fixed this in the X direction by determining the width of the longest label (as rendered in the appropriate font) and rotated the appropriate way to set the left padding in the plotAreaFrame.
Due to the rotation of the labels, if the plot at the bottom of the graph has a long name it can still extend off the bottom edge of the graph and get clipped there.
I know how tall vertically the rotated label is, but where I'm stuck is trying to determine where in the plot area the axis label is being plotted so that I can determine how much bottom padding is required.
I'm not sure if I should be trying to determine how tall the X axis label section is and then subdividing the remaining height to determine where the ticks should fall, or if there's some other better way to go about it.
The label is offset from end of the nearest tick mark by the labelOffset. The position of the end of the tick mark depends on the tickDirection, tickLabelDirection, and majorTickLength.
There are methods that allow you to convert a point from the plot space coordinate system to the view coordinate system. I've ended up solving the problem with code like the following:
// Tell the graph to lay itself out if it needs to.
[self.graph layoutIfNeeded];
// Create a point that represents 0,1 as plotted on the graph.
NSDecimal plotPoint[2];
plotPoint[CPTCoordinateX] = CPTDecimalFromInt (0);
plotPoint[CPTCoordinateY] = CPTDecimalFromInt (1);
// Convert that point from the plot coordinate system to the view coordinate system
CGPoint point = [self.graph.defaultPlotSpace plotAreaViewPointForPlotPoint: plotPoint];
// If the difference between the height of the rotated label and the position that it
// will be plotted at is at least the bottom padding, then the height is too large,
// so fix the padding.
if (labelHeight - point.y >= self.graph.plotAreaFrame.paddingBottom)
[self.graph.plotAreaFrame setPaddingBottom: (labelHeight - point.y)];
My graphs have a default bottom padding already set as a minimum, allowing this code to bump it up if there isn't enough already.

Resources