无法使用jqplot获取条形图的xaxis值

时间:2014-11-19 12:19:00

标签: charts

function SetupBarChartFilter(id, listData) {  
if (listData.length > 0) {
    // Prepare data for jqplot
    refinementCount = [];
    refinementName = [];
    refinementData = [];
    for (var i = 0; i < listData.length; i++) {
        var filter = listData[i];
        var name = filter.RefinementName.slice(0, 20);
        var count = filter.RefinementCount;
        var item = [name, count];

        refinementCount.push(count);
        refinementName.push(name);
        refinementData.push(item);
    }

    ticks = [];

     ticks.push = refinementName;

    // call jqplot
    $.jqplot.config.enablePlugins = true;
    var plot = $.jqplot(id, [refinementCount], {
        // Only animate if we're not using excanvas (not in IE 7 or IE 8)..
        seriesColors: ['#0072C6', '#73C774', '#C7754C', '#17BDB8', '#00749F'],
        animate: !$.jqplot.use_excanvas,

        seriesDefaults: {
            renderer: $.jqplot.BarRenderer,
            rendererOptions: {
                // Set varyBarColor to tru to use the custom colors on the bars.
                varyBarColor: true,
                barWidth: 15,
                barPadding: 4,
                barMargin: 5,

            },
            pointLabels: { show: true },

        },

            axes: {
                xaxis: {
                    renderer: $.jqplot.CategoryAxisRenderer,
                    ticks: refinementName,

                    tickRenderer: $.jqplot.CanvasAxisTickRenderer ,
                    tickOptions: {
                        fontFamily: 'Georgia',
                        fontSize: '8pt',
                        angle: -40,
                    },
                },
            },

        highlighter: {
            show: false               
        }

    });
 }     

}

我得到带有计数值的条形图。但是无法在xaxis中看到滴答声。当我在这里传递refinementCount var plot = $ .jqplot(id,[refinementCount]时,只有我可以看到条形。并且使用ticks:refinementName,我得到了xaxis值名称。但是它们都相互覆盖,它们不会# 39; t显示为条形图。任何人都知道如何使用jqplot获取条形图值。

0 个答案:

没有答案