在jQuery中防止条形图重叠categoryAxis?

时间:2018-02-09 06:37:57

标签: jquery bar-chart

enter image description here

使用jQuery在条形图中使用这种CategoryAxis - 它可能与否?

有谁知道如何在条形图上显示这种方式?请分享......

1 个答案:

答案 0 :(得分:0)

 categoryAxis: {

            field: "PropertyName",
            majorGridLines: {
                visible: false
            },
            //visible: true,
            labels: {

                visible: true,
                //rotation: "270"

                visual: function(e) {



                    var html =$('<span  class="unselcteddiv">'+capitalise(e.value) + '</span>').appendTo(document.body));

                    // Create an empty group that will hold the rendered label
                    var visual = new kendo.drawing.Group();

                    // Store a reference to the target rectangle, see below
                    var rect = e.rect;
                    if(e.dataItem.ShareDiff<0)
                    {
                        // debugger;

                        rect.origin.x =rect.origin.x>0?Math.abs(rect.origin.x)+Math.abs(rect.size.width)+20:rect.origin.x;
                    }
                    kendo.drawing.drawDOM(html)
                                  .done(function(group) {
                                      // Clean-up HTML fragment
                                      html.remove();

                                      // Center the label using Layout
                                      var layout = new kendo.drawing.Layout(rect, {
                                          justifyContent: "right"
                                      });
                                      layout.append(group);
                                      layout.reflow();
                                      // Render the content
                                      visual.append(layout);
                                  });

                    return visual;

                }

            }
        },

我可以使用此代码工作正常。我希望对每一个在这类问题上受苦的人充分利用......