【问题标题】:Kendo multi level bar chart issue zoom issue剑道多级条形图问题缩放问题
【发布时间】:2016-08-03 06:24:15
【问题描述】:

我用剑道生成了图表

它的 2 级图表

Here is the js fiddle with 2 level's of chart

问题是,当在剑道图表网格线中使用 pan & zoom 缩放图表时显示不匹配。

生成图表后的实际图像。

应用平移和缩放后

其实这就是我要找的……剑道没有显示正确的位置

jQuery("#chart").kendoChart({
"chartArea": {
    "height": 500
},
"title": {
    "text": "Working women in Bahrain"
},
"legend": {
    "labels": {
        "template": "#= series.name #"
    },
    "position": "top"
},
"series": [{
    "name": "Divorced",
    "type": "column",
    "data": [85393, 77464, 96399, 83679, 115378, 96117, 81731, 77118, 86773, 89057, 101897, 81349],

    "stack": false
}, {
    "name": "Married",
    "type": "column",
    "data": [77220, 85787, 94838, 92456, 93399, 89375, 79801, 87342, 105411, 100824, 94300, 92005],        
    "stack": false
}, {
    "name": "Single",
    "type": "column",
    "data": [102443, 91787, 100185, 86968, 99938, 104390, 102129, 98333, 92575, 69093, 88107, 84893],        
    "stack": false
}, {
    "name": "Widow",
    "type": "column",
    "data": [97150, 85356, 97143, 95212, 97313, 93572, 87118, 91988, 103927, 91054, 93480, 90099],        
    "stack": false
}],
"categoryAxis": [{
    "labels": {
        "rotation": {
            "angle": "auto"
        }
    },
    "majorGridLines": {
        "visible": false
    },
    "title": {
        "text": "Sectors",
        "position": "left"
    },
    "categories": ["Private", "Public", "Private", "Public", "Private", "Public", "Private", "Public", "Private", "Public", "Private", "Public"]
}, {
    "labels": {
        "rotation": {
            "angle": "auto"
        }
    },
    "majorGridLines": {
        "visible": true
    },
    "line": {
        "visible": true
    },
    "title": {
        "text": "Year",
        "position": "left"
    },
    "categories": ["2010", "2011", "2012", "2013", "2014", "2015"]
}],
"valueAxis": [{
    "majorGridLines": {
        "visible": false
    }
}],    
"tooltip": {
    "format": "{0}%",
    "template": "#= series.name #: #= value #",
    "visible": true
},
"pannable": {
    "lock": "y"
},
"zoomable": {
    "mousewheel": {
        "lock": "y"
    },
    "selection": {
        "lock": "y"
    }


  }
});

【问题讨论】:

    标签: javascript kendo-ui telerik kendo-asp.net-mvc kendo-chart


    【解决方案1】:

    可能不完全是您想要的,但对于年份轴,通过每年设置两次,确保您拥有与部门轴相同数量的类别。然后将 step property 用于标签、majorTicks 和 majorGridLines:

    {
        "labels": {
            "rotation": {
                "angle": "auto"
            },
            step: 2
        },
        "majorGridLines": {
            "visible": true,
            color: "black",
            step: 2
        },
        majorTicks: {
            step: 2
        },
        "line": {
            "visible": true
        },
        "title": {
            "text": "Year",
            "position": "left"
        },
        "categories": ["2010", "2010","2011","2011", "2012","2012", "2013","2013", "2014","2014", "2015", "2015"]
    }
    

    DEMO

    【讨论】:

    • @esanker 当我缩放图表时(在平移和缩放的帮助下)这个主要的网格线显示在错误的位置......如果你为此应用平移和缩放......你可以看到问题....
    • @PrasadRaja,随着我的更改,majorgridlines 现在在任何缩放级别都是正确的:codepen.io/ezanker/pen/grdyoR 使用鼠标滚轮放大 codepen 演示。
    • 这个例子有问题(当你平移/缩放图表时,我们有根据年份关于公共/私人的主要网格线,当你拖动/移动轴时它不匹配)。 ..如果你注意到你可以看到问题。我们将不胜感激。
    • @PrasadRaja,对我来说,当我在 codepen 中运行我的示例时,问题已解决。您仍然在 codepen 中看到问题吗?如果是这样,在什么浏览器上?
    • 问题是(当您平移/缩放图表时,我们有关于公共/私有年份的主要网格线,当您拖动/移动轴时主要网格线不匹配)...你注意到了吗? (Chromer 浏览器)
    【解决方案2】:

    @ezanker

    Code Pen Demo

    http://codepen.io/prasadraja07/pen/ZOqQWq/

    我为您创建了另一个代码笔来通知问题..

    我已在舞台级别附加图像

    **生成图表级别 1 **

    平移/缩放后

    缩放/平移问题图像,主要网格线不匹配

        jQuery("#chart").kendoChart({
            "chartArea": {
                "height": 500
            },
            "title": {
                "text": "Testing"
            },
            "legend": {
                "labels": {
                    "template": "#= series.name #"
                },
                "position": "top"
            },
            "series": [{
                "name": "Private",
                "type": "column",
                "data": [2647.67, 2273.22, 2685.17, 2455.22, 2506.39, 2603.03, 2790.78, 2893.28, 2722.17, 2807.06, 2894.61, 2854.72, 2122, 2883.83, 2384.44, 2353.58, 3053.56, 2350.03, 2822.92, 2570.33, 2679.78, 2398.89, 2685.22, 2730.11],
                "labels": {
                    "visible": true
                },
                "stack": false
            }, {
                "name": "Public",
                "type": "column",
                "data": [2111.03, 2309.56, 2203.75, 2831.06, 2430.86, 2666.58, 2382.61, 2473.14, 2553.5, 2700, 2851.81, 2546.19, 2097.92, 2684.31, 2485.89, 2586.92, 2338.94, 2535.83, 2272.75, 2575.47, 2458.39, 2740.58, 2160.53, 2316.78],
                "labels": {
                    "visible": true
                },
                "stack": false
            }],
            "categoryAxis": [{
                "labels": {
                    "rotation": {
                        "angle": "auto"
                    }
                },
                "majorGridLines": {
                    "visible": false
                },
                "title": {
                    "text": "Governorate",
                    "position": "left"
                },
                "categories": [
                                                                    "Category1", "Category2", "Category3", "Category4", "Category1", "Category2", "Category3", "Category4", "Category1", "Category2", "Category3", "Category4", "Category1", "Category2", "Category3", "Category4", "Category1", "Category2", "Category3", "Category4", "Category1", "Category2", "Category3", "Category4"]
            }, {
                "labels": {
                    "visible": true,
                    "step": 4,
                    "rotation": {
                        "angle": "auto"
                    }
                },
                "majorGridLines": {
                    "width": 1,
                    "step": 4,
                    "color": "black",
                    "visible": true
                },
                "title": {
                    "text": "Year",
                    "position": "left"
                },
                "majorTicks": {
                    "step": 4
                },
                "categories": ["2010", "2010", "2010", "2010", "2011", "2011", "2011", "2011", "2012", "2012", "2012", "2012", "2013", "2013", "2013", "2013", "2014", "2014", "2014", "2014", "2015", "2015", "2015", "2015"]
            }],
            "valueAxis": [{
                "majorGridLines": {
                    "visible": false
                }
            }],
            "transitions": false,
            "tooltip": {
                "format": "{0}%",
                "template": "#= series.name #: #= value #",
                "visible": true
            },
            "pannable": {
                "lock": "y"
            },
            "zoomable": {
                "mousewheel": {
                    "lock": "y"
                },
                "selection": {
                    "lock": "y"
                }
            }
        });
    

    【讨论】:

    • 我现在看到了。我认为你应该向 Telerik 询问这件事。
    猜你喜欢
    • 1970-01-01
    • 2018-08-18
    • 1970-01-01
    • 1970-01-01
    • 2021-02-26
    • 1970-01-01
    • 1970-01-01
    • 2019-12-30
    • 1970-01-01
    相关资源
    最近更新 更多