I'm using jQuery Sparklines on an html page which is scaled using transform: scale
. Unfortunately, this causes the tooltip generated by jQuery Sparklines to be displayed in the wrong spot.
For example, the following code...
<style>
body {
transform: scale(0.7);
transform-origin: 0 0;
}
</style>
<script type="text/javascript" src="jquery-3.2.1.min.js"></script>
<script type="text/javascript" src="jquery.sparkline.min.js"></script>
<script type="text/javascript">
$(function() {
var myvalues = [10,8,5,7,4,4,10];
$('#line').sparkline(myvalues, {
type: 'line'
});
});
</script>
<div> random text random text random text random text random text random text <span id="line"></span> </div>
... results in this:
Is there some way to fix this behaviour?
Rename your style from "body" to "div" it will work.
As the transfer:scale is affecting the whole page, we need to specify to the specific div tag.