Implement ToolTip feature in Line Chart - jsf

I Have implemented a Primeface 3.5 line chart.I have also added the tool tip feature.
Now I want is that , if I click on the coordinate , it should show me the origination of those points.
eg:
The highlighted coordinate 2006 is summation of (1000 + 1006), so when I place my cursor on the point it should show me (1000+1006).
How do I implement the feature?
as short of reputation I could not upload the image to explain it

In jqplot attributes, you can specify to show the value on x axis, y axis or both in tooltipAxis attribute.
Alternatively, you can bind a javascript function with a jqplot event jqplotDataHighlight to show a custom value on mouse hover.
See this answer

Related

Re-scaling x, y-axis on capture correct coordinate scale on mouse-over in matplotlib

I am rendering a data as shown below using cluster analysis.
As you can see that ports in the range of 0-200 are clubbed together. Is there a way to zoom in on the scale when I mouse over a coordinate and thereby redrawing that section of the graph again in a zoomed window. What i mean is that for the coordinates shown in blue circle, when I mouse over, I want the x, y axis redrawn for 0-10000 using a different scale so that overlapping circles move apart. Is it possible ?. I must confess I find matplotlib little challenging and my apologies if my question is little cryptic. thanks for the help!
Assuming youre using pyplot then this functionality is built right in to the pyplot output.
See the following from the matplotlib documentation.
The Zoom-to-rectangle button
Click this toolbar button to activate this mode. Put your mouse somewhere over an axes and press the left mouse button. Drag the mouse while holding the button to a new location and release. The axes view limits will be zoomed to the rectangle you have defined. There is also an experimental ‘zoom out to rectangle’ in this mode with the right button, which will place your entire axes in the region defined by the zoom out rectangle.
If you need to enable zoom to rectangle functionality without actually clicking then this will be possible by creating a transparent figure positioned in a location of your choice on your plot and then initiating a matplotlib event to be handled when the mouse hovers over this area. This functionality is not built in and will require customisation.
Detail relating to event handling on mouseover events can be found at this URL

OpenLayers 3: align/rotate labels with line features

Is it possible to align/rotate text labels to a line feature? For example, if a line runs southwest to northeast (45 degrees), then the text placement should also be 45 degrees? Is this possible? I did look through the OL documentation but couldn't find anything of this nature.
You can't make a label "follow" a line in OpenLayers 3, but you can rotate it. See in this example: http://openlayers.org/en/latest/examples/vector-labels.html
Try setting the "Rotation" then hit the refresh button and you'll see the label being rendered on that angle.
If you use a style function, you could calculate the average angle of the line to determine the angle to render its label.

jQuery Flot: Adjust xaxis zoom in/out to calendar

Using jquery.flot.navigate.js I can have flot zoom in/out on mouse wheel/ double click by specified amount (e.g. x1.5). What I need, is zoom by calender. By that I mean zooming in/out by the boundaries of hour/day/week/month/year.
Is there any way to achieve a callback/ interaction with the navigate plugin or custom solution?
Solved by modifying jquery.flot.navigate.js to call a callback function after adjusting axis min/max due to scale/pan/double-click. The callback can then further adjust the zoom boundaries as needed before the chart is redrawn.

Math for zoom to cursor on mouse wheel scrolling

Have to implement a Directx9 project that involves zoom towards the cursor like Google maps with the mouse scroll wheel
(similar to this implementation by Phrogz).
Need the math and the variables required for the same.
Solved this problem using below steps
Decide per scroll movement, call it Z-SHIFT, in Z-direction towards the target point
such that the camera should travel to target in fixed scrolls(SCROLL_COUNT)
Calculate the distance to travel in X and Y directions, say DIST_X and DIST_Y
Movement per scroll in X-direction and Y-direction will be calculated as
X-SHIFT = DIST_X/SCROLL_COUNT
Y-SHIFT = DIST_Y/SCROLL_COUNT
Z-SHIFT = Pre decided suitable value
We have mathematical equation to guide the coordinates of the camera per scroll which when placed in the code provides the required zoom to cursor effect.

QuirksMode mouse position incorrect for SVG in a jQueryUI tab?

I've just noticed something strange. If I draw an SVG shape, the co-ordinates I supply as the shape's x and y attributes don't match up with the co-ordinates returned by a mouse event on that shape, when using the standard ways of returning the mouse position.
For example, if I draw a rectangle as follows:
shape = svgDocument.createElementNS(svgNS, "rect");
shape.setAttributeNS(null, "x", rect_x);
shape.setAttributeNS(null, "y", rect_y);
...
shape.addEventListener("mouseover", etc);
in the event routine, I get the mouse position using the QuirksMode algorithm (the "correct script for detecting the mouse co-ordinates", at http://www.quirksmode.org/js/events_properties.html). For the Y co-ordinate, I have to correct the QuirksMode value as follows, in order to get to 'rect_y':
F/F 8 subtract 105
Webkit subtract 103
IE9 subtract 104
Opera subtract 103
What's also curious is that both Webkit and IE9 provide evt.offsetY, and set it to the 'correct' position (exactly equal to 'rect_y'). FF leaves offsetY undefined, and Opera sets it to 1.
I suspect that the issue is that this is in a jQueryUI tab, although I haven't worked this through yet. Anyone seen this? Any thoughts?
In SVG you would use the getScreenCTM method to convert co-ordinates rather than offsetX or offsetY etc. There's an example here: http://www.carto.net/svg/eventhandling/ Search for the Converting clientX to viewBox coordinates part. It's a bit complicated as it tries to cope with old UAs such as ASV3 that don't have a getScreenCTM method.

Resources