首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >每个条形的jqplot高亮显示

每个条形的jqplot高亮显示
EN

Stack Overflow用户
提问于 2011-11-02 20:41:11
回答 1查看 1.3K关注 0票数 2

我有条形图和下面的代码:

代码语言:javascript
复制
 var line1=[['0-1',275134],['2-3',261562],['4-5',285681],['6-7',915432],['8-9',555131]];
 var line2=[['0-1',353628],['2-3',287898],['4-5',297550],['6-7',103313],['8-9',616089]];
 jQuery.jqplot('_container', [line1, line2], 
 {
    title: 'title',
    seriesColors: [ "#eee", "#ccc"],
    seriesDefaults:{
            renderer:jQuery.jqplot.BarRenderer, 
            rendererOptions:{barPadding:5, barMargin:5,highlightColors: ["#000", "#FF1100"]},
            pointLabels: {show: false}
    },
    legend:{
        renderer: jQuery.jqplot.EnhancedLegendRenderer,
        show:true,
        showLabels: true,
        labels: ["Label 1", "Label 2"],
            rendererOptions:{numberColumns:2},
            placement:'outsideGrid',location:"s"
    },
    axes:{
        xaxis:{renderer:jQuery.jqplot.CategoryAxisRenderer, rendererOptions:{showDataLabels: false},showTicks: false},
        yaxis:{tickOptions: {showGridline: true}}
    },
    highlighter: {
        tooltipAxes: 'y',
        formatString:'%s'
    },
    cursor:{style:'default', show: true, zoom:true, showTooltip:false}
 });

如何通过seriesColors的方式为栏添加突出显示,所以添加了highlightColors的另一种工作方式它突出显示前四个栏("#000","#000","#FF1100","#FF1100"),但需要的结果是("#000","#FF1100","#000","#FF1100","#FF1100",...)?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2012-05-30 21:52:24

您在这里遇到的问题是由barRenderer.js中的错误引起的,修复它的唯一方法似乎是编辑其代码, as explained here.的适当行

所需的更改涉及在行中用sidx替换pidx

var opts = {fillStyle: s.highlightColors[pidx]};

为了验证这一点,我让a jsfiddle where you can quickly see that it fixes来解决问题。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/7980475

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档