Mouse click is hooking to a point


« 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 Sai Krishna Movva on 7th September 2016
Hi,

I am trying to make an adjustable line chart. But when I click the point to be adjusted, cursor gets hooked to the point and only leaves when I click cursor somewhere not on the respective point. I want it to adjust only when I am holding.

Following is my code,

var l1 = new RGraph.Line({
                 id: 'cvs',
                 data: [
                     yValues
                 ],
                 options: {
                     gutterTop: 50,
                     labels: xValues,
                     linewidth: 2,
                     // spline : true,
                     colors: ['black'],
                     // numxticks: 8,
                     adjustable: true,
                     tickmarks: "circle",
                     ylabelsOffsetx : 30,
                     tooltipsHighlight : true,
                     tooltips: yValuesDup.map(String),
                     ymax: 1.25 * Math.max.apply(this, yValues),
                     ymin: 0.75 * Math.min.apply(this, yValues),
                     textSize: 8,
                     textAccessible: true
                 }
             }).draw().on('adjustend', function(obj) {
                 var shape = RGraph.Registry.get('chart.adjusting.shape');
                 var index = shape.index;
                 console.log(index);
                 var value = l1.original_data[0][index];
                 console.log(xVal[index]);
             });


Can you help with this?
Posted by Richard on 7th September 2016
Hi there,

Your adjustend event uses the xVal variable - which is undefined. This causes an error and stops adjusting working correctly. Comment out that line and it will work correctly.

You can see these errors by using your browsers console:

www.rgraph.net/docs/howto-debug-your-charts-with-chrome.html




Richard

Add a reply

 




« Back to message list
RGraph on social media