The SVG HBar chart does not seem to follow the gutterLeft setting


« Back to message list

Enter your email address to get email updates on this topic. You can stop receiving updates by clicking the link in the update email messages.

Posted by Jan Dirk on 27th February 2017
Hi Richard,

I've the following example:

<html>

<head>
     <script src="..."></script>
</head>
<body>
     <div id="g" style="width: 250px; height: 500px; border: solid 1px" />
<script>
     var data = [1, 2, 3];
     new RGraph.SVG.HBar({
         id: 'g',
         data: data,
         options: {
             gutterLeft: 35,
             gutterRight: 35,
             yaxisLabels: ['First quite long description', 'Second quite long description', 'Third quite long description' ],
         }
     }).draw();
</script>
</body>
</html>

I would expect that the (y)labels should be truncated to 35 pixels, but that seems not to happen. I think here is some issue.

As a workaround, I'll truncate the labels myself, because I actually want to shorten them anyway, preferably showing the first and last part with dots in between and a tooltip that shows the complete label.

I'd like to be able to have HTML tags in my labels, so I can e.g. include a div that shows an ellipses on overflow and a tooltip, while hovering the label and possibly have an on-click or on-context-menu on these labels. Is it possible to add this possibility as well, or is there already a way to do this?

Regards,

Jan Dirk
Posted by Jan Dirk on 27th February 2017
Hi Richard,

on 31st August 2016, I've asked also a question about tooltips on labels, but than for canvas.
I assume that the workaround you gave at that time does not work for SVG? At least, when I rapidly look into your code, it does not seem to be so.
Is that any workaround for SVG? Or can you indeed implement the request from above (allowing html in the labels) in the next version?

Regards,

Jan Dirk
Posted by Richard on 27th February 2017
Hi there,

The gutterLeft setting not being honored is indeed a bug - I'll take a look at that. As for the label truncation, you'll need to do that before you give the labels to RGraph and then show the full label in the tooltip.




Richard
Posted by Richard on 27th February 2017
Hi there,

And for the HTML in the labels - that's not supported in SVG I'm afraid.





Richard
Posted by Jan Dirk on 27th February 2017
Hi Richard,

Thanks for the response.

Regards,

Jan Dirk
Posted by Richard on 4th March 2017
Hi there,

I've just had a look at this and it looks like the way to get your own gutterLeft setting is to turn off autosize:

...
gutterLeft: 150,
gutterLeftAutosize: false,
...




Richard
Posted by Jan Dirk on 6th March 2017
Hi Richard,

I set now the gutterLeftAutosize to false, and it indeed seems to work,

Thanks,

Jan Dirk

Add a reply

 




« Back to message list
RGraph on social media