最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Flot chart: How to removehide tick values along y-axis? - Stack Overflow

programmeradmin1浏览0评论

I want to remove tick values (3.5, 3.0, 2.5, 2.0, 1.5, 1.0, 0.5, 0.0) along y-axis. For more information please see below picture. If can not remove then there must be some option to change the color. I will make it transparent.

var data = [{data: [[0,1]], color: "red"},
            {data: [[1,2]], color: "yellow"},
            {data: [[2,3]], color: "green"}];

$.plot("#placeholder",data, {
    series: {
        bars: {
            show: true,
            barWidth: 0.3,
            align: "center",
            lineWidth: 0,
            fill:.75
        }
    },
    xaxis: {
        ticks: [[0,"Red"],[1,"Yellow"],[2,"Green"]]
    }
});

Here is the example I am following for this: /

I want to remove tick values (3.5, 3.0, 2.5, 2.0, 1.5, 1.0, 0.5, 0.0) along y-axis. For more information please see below picture. If can not remove then there must be some option to change the color. I will make it transparent.

var data = [{data: [[0,1]], color: "red"},
            {data: [[1,2]], color: "yellow"},
            {data: [[2,3]], color: "green"}];

$.plot("#placeholder",data, {
    series: {
        bars: {
            show: true,
            barWidth: 0.3,
            align: "center",
            lineWidth: 0,
            fill:.75
        }
    },
    xaxis: {
        ticks: [[0,"Red"],[1,"Yellow"],[2,"Green"]]
    }
});

Here is the example I am following for this: http://jsfiddle/TPp8m/

Share Improve this question edited Jan 20, 2016 at 5:44 Amar Singh 5,6223 gold badges29 silver badges55 bronze badges asked Jan 20, 2016 at 5:38 Vikasdeep SinghVikasdeep Singh 21.8k16 gold badges82 silver badges106 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 5

You can set yAxis ticks as an array to get only those values, for your question I added

yAxis{
ticks: [] 
}

Check fiddle

As you said , You just want to hide all y axis values than you can Use $("#placeholder").find(".tickLabel").hide();

and show it again Using:

$("#placeholder").find(".tickLabel").show();

Jsfiddle

发布评论

评论列表(0)

  1. 暂无评论