Legend labels start in the wrong place and jump

34 views
Skip to first unread message

davidac...@gmail.com

unread,
Nov 29, 2016, 10:02:07 AM11/29/16
to JSXGraph
Hi folks,
    I am a new user and this is my first post!  I am trying to put a legend on a bar chart.  The code is pretty simple:

https://jsfiddle.net/dcharter/ycsajme7/

The problem is, when you load the page, the labels for the legend are covered up with the color bars.  When you click Start, they jump into the expected place.  I have searched all over an have not found much about legends.  Any help you all could provide would be awesome!
Thanks!
David

Alfred Wassermann

unread,
Nov 29, 2016, 11:12:22 AM11/29/16
to JSXGraph
Thank you for pointing this out. We will try to fix this bug soon. Until then, a quick workaround is to trigger a board update after creating the legend. In your case it would be

var legend = brd_grph_bar.create("legend", [0.5,140],{labels: ["Kinetic Energy", "Potential Energy", "Total Energy"],colors: ["red", "blue", "green"]});  
brd_grph_bar
.update();




Best wishes,
Alfred

davidac...@gmail.com

unread,
Nov 29, 2016, 11:30:03 AM11/29/16
to JSXGraph
Hi Alfred,  that workaround works perfectly.  Thanks so much for your great support!
David
Reply all
Reply to author
Forward
0 new messages