I have two plugins, one which displays a horizontal line across a chart (example image show below) and one which displays a label inside a donut chart. In both cases when the tooltip is triggered for the base chart, it displays beneath (i.e. lower z-position) the plugin's drawing.
I know I can create a fully customized tooltip which might solve this problem, but wanted to know if there was a configuration I'm not seeing or a simpler solution.
I can post code if necessary, but didn't think it'd be useful.
I believe that you should have posted the code for clarity. Since you are talking about plugins, you have overridden at least one plugin method. One of the methods you have overridden is probably afterDraw. Overriding afterDraw would present the problem you mention, I believe. Try changing afterDraw to afterDatasetsDraw. Look at the docs for the plugin methods that can be overridden. You want the lines to be drawn before the tooltip is drawn, so drawing the lines right after the datasets are drawn seems like a nice solution. Maybe using beforeDatasetsDraw instead would be a nice solution too, depending on whether you would want the bars to be above the lines or not.
Related
By default konva-transformer use little rectangles in the middle of the border (middle-left, middle-right, top-center, bottom-center) . But i want to change resize by borders, like that
Is there any library that solves my problem or an easy way to implement it?
Look at the example, you just need to update the logic in the Transformer class
codesandbox.io/s/he5jq?file=/src/index.js
First off, have you considered how this will work for users that are using a touch-based interface, where there is no realistic potential for a mouseover event?
As an alternative, you could switch off the corner handles (as shown in your image) and switch on only the edge handles. There is a demo here that shows all the config options for the transformer which may be of assistance, more explanation here.
// set handlers on edges only.
transformer.enabledAnchors(['top-center', 'middle-right', 'middle-left', 'bottom-center',]);
To answer your question specifically, there is nothing in Konva.js to do this for you. You would have to develop it for yourself unless someone else can provide sample code.
The way to approach it would be to draw four lines (not a rect, four individual line shapes) around the selected shapes and use the mouseover & mouseout events to give you the necessary info to show / hide the cursor, etc.
I have to implement some graphs in a project I am building. I am currently studying what graph solutions I have, as I do not plan to code the graphs from scratch.
I ran into GraphJS and it seems to have everything I need. I should mention that the graphs are not complex in data they hadnel, but in the way they looks. Therefore we reach the question: can the tooltips of the axis be customised? I have to implement something like this
Better said, I need every second day in a 30 days span to not be displayed, but in its place to be shown a grey line. It is possible to achieve something like this with ChartJS?
I have read the documentation, I have not wrote any code as I am looking to find the proper library to use. On the same note, I do not seek an answer from someone providing me code, merely a "yes" or a "no".
There is an effect of pointing to a special element of image with line.
See example of crocodile at http://snapsvg.io/.
When the image appears at first there is no any pointing with lines:
Then after scrolling appears lines with hints:
I know there is https://github.com/julianlloyd/scrollReveal.js and a lot of other js libraries for effect of appearing.
The question is how to make this lines, place them at the exact point on top of usual image (not SVG) and animate lines on scrolling?
Would be great to know the name of this approach/effect (what to google) and see reviews on good/bad experience, or js libraries.
Update: want to see resolved issue with image resizing and exact pointing,
In most cases, see example at http://www.sitmed.com.br/produto?id=2, image has fixed isze and is not scalable, this will not work for big or small screens.
I think it is possible to write scaling library in javascript, using svg/canvas or even plain div.
Otherewise points will jump on image scaling.
To make these lines and place them at exact position:
The easiest is to use canvas or svg. Here are a few links to do that.
Drawing lines on html page
Drawing arrows on an HTML page to visualize semantic links between textual spans
Placing the lines is easy if you're using canvas. If you are using images for lines, you can place these lines with respect to the big crocodile. Not a big deal.
Animate lines on scrolling
A good place to start with knowing about animations is to learn any animation framework. I would suggest Greensock Animation Platform(GSAP). It is open source and also well supported. They have good tutorials and docs for beginners. You can animate in a very abstract manner using GSAP. Rapheal.js is also good for animating svg images.
As for as scrolling is concerned, you can find many plugins including the one which is mentioned in the question.
Just use a parallax scrolling type js library such as Skrollr. It's very easy to just make the lines a div with a background color, and then as you scroll the page the div grows in length.
The effect you are describing makes me think you are looking for something like flow or organization chart "connectors" which anchor arrows in a chart to glue points on each element. In more general graphics terminology these are likely just known as "line anchor points" or something similar.
JointJS is a great charting/drawing library for HTML5 and SVG that could make what you are doing fairly easy to do, but a simpler "CSS only" might be all you need. If you are you really looking to animate the image then the more sophisticated javascript library approach might be worthwhile. JointJS uses Raphael and Backbone.js so you get a lot of power tools in the box.
You can use this library for drawing SVG lines, its quite configurable and well documented. You basically need to specify your "From" and "To" elements and a line will connect them for you.
Then you can play with the line's stroke-dasharray and stroke-dashoffset properties on scroll to achieve effect of the line being drawn.
More of SVG animation here
I have used this approach and its quite cool looking, hope this helps
I think the best way to implement this depends greatly on what animation you're going for. To reproduce something similar as in your example, you could just stack different images (one for the crocodile and one for each component). Then as you scroll, you could change the z-index of the crocodile and use css animation to "wobble" the size of the element you just revealed. Put all of the images in one div together, to make sure they scale together and align nicely and you're done.
But for something else the work might be completely different of surprisingly similar, I really don't think there's one solution that fits all needs, except if you want to use the canvas as already suggested, but that depends on the complexity of the graphics you want to reveal.
I am looking to implement a map with a 'play/pause' feature that will overlay items as the time scale progresses. However, I also wanted to give users the ability to set the time themselves. Very similar to
Mike's work here
Any ideas on the best way to implement this? I would like to avoid html element sliders because of a lack of styling options (as far as filling up the bar with different colors, it gets messy overlaying SVG). There is also d3.slider (independent open source on git), but the documentation is lacking. Is using a brush handler the best option?
Thank you!
We have upgraded our higstock version from v1.2.5 to the latest (v1.3.9).
We have had to do many minor tweaks and changes, which we have now sorted to make it work as it did before, however, there are a couple of issues that remain and are proving hard to resolve.
The first is rounded end points on one of our bar charts;
postimg.org/image/6uqvr5szd
(The highlighted end points used to be flat and not overlap)
postimg.org/image/426uym7eh
(How it looks in old version (preferred))
The second (which seems like it could be related) is as follows;
postimg.org/image/n0gyaz9cr
(Again more roundedness)
postimg.org/image/yuncfy43b/
(How it looks in old version (preferred))
I have checked borderRadius, symbol, marker settings etc. etc. but nothing obvious is causing these issues.
Furthermore we have many other types of charts which all seem to be fine.
NB:
The second issues are an attempt at a basic Gantt chart as described by Torstein Hønsi in this post;
http://highcharts.uservoice.com/forums/55896-general/suggestions/804783-gantt-chart
(I would also have added the images here, or the links, but StackOverflow forbid it because of my low reputation!)
As always, any help appreciated.