admin管理员组文章数量:1391977
Can any one suggest me the way of adding style to the title of the C3.js donut chart ?
For any donut c3 chart is there any option to set the title style ?
I am using this code for my Donut chart.
var chart = c3.generate({
data: {
columns: [
['Monday', 70],
['TuesDay', 20],
['Wednesday', 30],
['Thursday', 50],
['Friday', 100]
],
type: 'donut'
},
donut: {
title: "Usage " // How to do? style("color", "#59C2E6")
}
});
Can any one suggest me the way of adding style to the title of the C3.js donut chart ?
For any donut c3 chart is there any option to set the title style ?
I am using this code for my Donut chart.
var chart = c3.generate({
data: {
columns: [
['Monday', 70],
['TuesDay', 20],
['Wednesday', 30],
['Thursday', 50],
['Friday', 100]
],
type: 'donut'
},
donut: {
title: "Usage " // How to do? style("color", "#59C2E6")
}
});
Share
Improve this question
asked Jan 9, 2016 at 7:30
LeMousselLeMoussel
5,76715 gold badges77 silver badges129 bronze badges
2 Answers
Reset to default 6Donut title
use class c3-chart-arcs-title
by render.
You can just override c3-chart-arcs-title
style. Your code should be like:
.c3-chart-arcs-title {
fill: red;
font-size: 16px;
}
just override the fill property of .c3-chart-arcs-title style class ,like this :
<html>
<head>
<link rel="stylesheet" href="//cdnjs.cloudflare./ajax/libs/c3/0.4.5/c3.min.css" />
</head>
<body>
<div id="chart"></div>
<script src="http://d3js/d3.v3.min.js" charset="utf-8"></script>
<script src="http://c3js/js/c3.min-12912fb6.js"></script>
<style>
.c3-chart-arcs-title {
fill: #59C2E6;
}
</style>
<script>
var chart = c3.generate({
data: {
columns: [
['Monday', 70],
['TuesDay', 20],
['Wednesday', 30],
['Thursday', 50],
['Friday', 100]
],
type: 'donut'
},
donut: {
title: "Usage " // How to do? style("color", "#59C2E6")
}
});
setTimeout(function () {
chart.axis.labels({
x: 'New X Axis Label',
y: 'New Y Axis Label',
y2: 'New Y2 Axis Label',
});
}, 1000);
setTimeout(function () {
chart.load({
columns: [
['data1', 100, 300, 600, 200, 400, 500]
]
});
chart.axis.labels({y: 'New Y Axis Label Again'});
}, 2000);
</script>
</body>
</html>
本文标签: javascriptHow can I add style to title of donut c3js chartStack Overflow
版权声明:本文标题:javascript - How can I add style to title of donut c3.js chart - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744757139a2623532.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论