2017-04-20 5 views
0

와 툴팁에 숫자를 포맷하는 방법은 다음과 같이 툴팁에 표시되는 숫자의 형식을 싶습니다ZingChart

var num = 0.1234567890; 
num.toFixed(4); 
"0.1235" 

내가 확인을 documentation하지만 날짜와 큰 숫자

와 그것을 주로 거래 이것을 할 수있는 방법이 있습니까?

답변

1

ZingChart에는 플롯에서 전역으로 숫자의 서식을 지정할 수있는 decimals 특성이 있습니다. 이것이 의미하는 바는 플롯 내에서 decimals 속성을 적용하면 valueBox이이 속성을 상속받으며 tooltip도 상속됩니다. 당신은 단지 도구 설명 개체 내에서이 작업을 수행 할 경우

plot: { 
    decimals: 4, 
    valueBox: { 

    } 
}... 

만 툴팁에 적용되는 잘린 값을 얻을 것이다.

참고 : JSON 특성 앞에있는 밑줄은 인라인 주석과 같습니다.

plot docs here

var myConfig = { 
 
    \t type: 'bar', 
 
    \t plot: { 
 
    \t _decimals: 4, 
 
    \t valueBox: {} 
 
    \t }, 
 
    \t tooltip: { 
 
    \t decimals: 4 
 
    \t }, 
 
\t series: [ 
 
\t \t { 
 
\t \t \t values: [35,42,67,89,25,34,67,85] 
 
\t \t } 
 
\t ] 
 
}; 
 

 
zingchart.render({ 
 
\t id: 'myChart', 
 
\t data: myConfig, 
 
\t height: '100%', 
 
\t width: '100%' 
 
});
html, body { 
 
\t height:100%; 
 
\t width:100%; 
 
\t margin:0; 
 
\t padding:0; 
 
} 
 
#myChart { 
 
\t height:100%; 
 
\t width:100%; 
 
\t min-height:150px; 
 
} 
 
.zc-ref { 
 
\t display:none; 
 
}
<!DOCTYPE html> 
 
<html> 
 
\t <head> 
 
\t <!--Assets will be injected here on compile. Use the assets button above--> 
 
\t \t <script src= "https://cdn.zingchart.com/zingchart.min.js"></script> 
 
\t <!--Inject End--> 
 
\t </head> 
 
\t <body> 
 
\t \t <div id="myChart"><a class="zc-ref" href="https://www.zingchart.com">Powered by ZingChart</a></div> 
 
\t </body> 
 
</html>