맨위로가기
 

SBCHART

닫기

Show/Hide

#latest  #options

차트의 구성 요소들을 보이거나 숨깁니다.

Options

  • axis.x.show = true/false
  • axis.y.show = true/false
  • grid.x.show = true/false
  • grid.y.show = true/false
  • axis.x.tick.outer = true/false, axis.y.tick.outer = true/false
  • data.labels = true/false
  • extend.point.show = true/false
    (Line, Spline, Area, StackArea 차트에만 적용됩니다)
  • legend.show = true/false
  • title.text = "제목"
    , 값이 있다면 show, 없으면 hide
  • tooltip.show = true/false
    (값을 변경하고 차트에 마우스를 올려보세요)

Example

사용 가능 차트 :

Code

var conf = {
    data: {
        type: "bar",
        columns: [
            ["2015",3.51,4.6,3.43,7.96,3.37,5.83,0.35,3.23,-0.09,4.47,2.21,1.13,0.77,0.35,0.92,2.65,1.64,8.08],
            ["2016",0.71,2.14,3.18,-1.84,0.79,0.35,0.28,0.44,0.79,0.84,1.33,-0.7,-1.51,0.09,1.05,-1.66,-0.58,4.63],
            ["2017",1.48,3.64,2.35,1.29,1.42,1.34,1.51,-1.08,4.29,1.67,2.4,-0.36,-0.53,1.98,2.23,-0.9,-1.62,1.66]
        ],
        labels: true
    },
    legend: {
        show: true
    },
    axis: {
        x: {
            show: true,
            tick: {
                outer: true
            }
        },
        y: { 
            show: true,
            tick: {
                outer: true
            }
        }
    },
    grid: {
        x: { 
            show: true
        },
        y: { 
            show: true
        }
    },
    extend: {
        point: {
            show: false
        }
    },
    title: { 
        text: "그래프 제목" 
    }
};
var chart = sb.chart.render("#chartWrap", conf);
//legend show/hide
document.getElementById("chkLegend").onchange = function() {
    chart.legend().show = this.checked;
    chart.render();
};
//axis-x show/hide
document.getElementById("chkAxisX").onchange = function() {
    chart.axis().x.show = this.checked;
    chart.render();
};
//axis-y show/hide
document.getElementById("chkAxisY").onchange = function() {
    chart.axis().y.show = this.checked;
    chart.render();
};
//grid axis-x show/hide
document.getElementById("chkGridX").onchange = function() {
    chart.grid().x.show = this.checked;
    chart.render();
};
//grid axis-y show/hide
document.getElementById("chkGridY").onchange = function() {
    chart.grid().y.show = this.checked;
    chart.render();
};
//point show/hide
document.getElementById("chkPoint").onchange = function() {
    chart.extend().point.show = this.checked;
    chart.render();
};
//title show/hide
document.getElementById("chkTitle").onchange = function() {
    chart.title().text = this.checked ? "그래프 제목" : "";
    chart.render();
};
//outer tick show/hide
document.getElementById("chkTickOuter").onchange = function() {
    chart.axis().x.tick.outer = this.checked;
    chart.axis().y.tick.outer = this.checked;
    chart.render();
};
//tooltip show/hide
document.getElementById("chkTooltip").onchange = function() {
    chart.tooltip().show = this.checked;
    chart.render();
};
//label show/hide
document.getElementById("chkLabels").onchange = function() {
    chart.data().labels = this.checked;
    chart.render();
};