在高图中的饼图中,从左到右,从右到左更改标签

时间:2015-05-10 19:03:21

标签: javascript jquery graph highcharts pie-chart

http://jsfiddle.net/tfpmuwd9/

if (degree >= 90 && degree <= 270) {
                    rotation = degree - 180;
                    point.dataLabel.x = 0;
                    point.dataLabel.y = 0;
                    point.dataLabel.translateX = (point.labelPos[2] + point.labelPos[4]) / 2;
                    point.dataLabel.translateY = (point.labelPos[3] + point.labelPos[5]) / 2;
                } else {
                    point.dataLabel.x = 0;
                    point.dataLabel.y = 0;
                    rotation = degree - 180;
                    point.dataLabel.translateX = (point.labelPos[2] + point.labelPos[4]) / 2;
                    point.dataLabel.translateY = (point.labelPos[3] + point.labelPos[5]) / 2;
                }

                point.dataLabel.rotation = Math.floor(rotation);
                point.dataLabel.show();
                point.dataLabel.updateTransform();

                });
                }
                }
        },

上面的链接是饼图。我想改变它的标签写的方向...从项目5,4,3写的问题4,3,2,1对于可读格式是好的,现在从项目1,2 ...我想写的是好的,从左到右现在我想从右到左......有一半是好的,但另一半是不合适的......

http://jsfiddle.net/tfpmuwd9/5/

if (degree >= 90 && degree <= 270) {
                    rotation = degree - 180;
                    point.dataLabel.x = 0;
                    point.dataLabel.y = 0;
                    point.dataLabel.translateX = (point.labelPos[2] + point.labelPos[4]) / 2;
                    point.dataLabel.translateY = (point.labelPos[3] + point.labelPos[5]) / 2;
                } else {
                    point.dataLabel.x = 0;
                    point.dataLabel.y = 0;
                    rotation = degree;
                    point.dataLabel.translateX = (point.labelPos[2] + point.labelPos[4]) / 2;
                    point.dataLabel.translateY = (point.labelPos[3] + point.labelPos[5]) / 2;
                }

                point.dataLabel.rotation = Math.floor(rotation);
                point.dataLabel.show();
                point.dataLabel.updateTransform();

                });
                }
                }
        },

我需要这个...但在适当的位置我该怎么办?

0 个答案:

没有答案