Gwt Highcharts Marker or Symbol Rotation

392 Views Asked by At

I'm testing Gwt Highcharts but I have a big problem: I need to draw a scatter chart with symbol and rotate the symbol. For example:

 Point p1 = new Point(5, 5); 
 Marker m = new Marker(); 
 m.setEnabled(true); 
 m.setRadius(4); 
 String myUrl = "url(" + GWT.getModuleBaseURL()+"images/snow.png" + ")";  
 m.setOption("symbol", myUrl);  
 p1.setMarker(m); 

This all works fine The problem is that I need to rotate the symbol by a degree value. I've tried the following code but it doesn't work:

String myRotate = "rotate(45)"; 
m.setOption("transform", myRotate);

What's wrong? Thanks a Lot. Maurizio

1

There are 1 best solutions below

0
On

This is what we've came up with in our case:

private static native void rotateMarkers(double angle)/*-{
    //Accessing the series we'll rotate
    var points = $wnd.Highcharts.charts[0].series[3].points;

    //rotating
        var str = parseFloat(points[i].graphic.attr('x')) +
          parseFloat(points[i].graphic.attr('width'))/2 +
          ","+ (parseFloat(points[i].graphic.attr("y")))+
          ")";
         points[i].graphic.attr("transform","rotate("+angle+","+str);
}-*/;

It didn't work for us in non-jsni way, same way it didn't for you.