Here is a solution that I am building quickly using jQuery. It can be easily modified to use Vanilla Javascript, but in order to quickly write it, I resorted to the framework.
Basically it consists of a <div> , which is relatively positioned with bindings as graphs that are absolutely located . This allows us to use the coordinates to place charts anywhere in the relative <div> .
You can create several icons that will display different charts on the chart and assign them to snap elements.
To make things nice and easy, I used a JSON object to store each plot so you can use it from a third-party source.
// change this to fit your needs var plots = [ {"width":30,"height":30, "top": 150, "left": 100, "content": "Lorem"}, {"width":20,"height":20, "top": 100, "left": 20, "content": "Ipsum"}, {"width":50,"height":50, "top": 20, "left": 20, "content": "Dolor"} ]; // store our 2 divs in variables var $content = $("#content"); var $map= $("#map"); // Iterate through each plot $.each(plots, function() { // store 'this' in a variable (mainly because we need to use it inside hover) var plot = this; // create a new anchor and set CSS properties to JSON values var $plot = $("<a />") .css({ 'width': plot.width, 'height': plot.height, 'top': plot.top, 'left': plot.left }) .hover(function() { // replace content of target div $content.html(plot.content); }); // Add the plot to the placeholder $map.append($plot); });
Hope I wrote this in an easily understandable way :)
Please note that all of the above can be achieved using only HTML / CSS, just check the source to see what exactly is being created.
Here is a demo
source share