javascript - C3图表点为空圆

标签 javascript c3.js

我正在使用 C3 生成折线图。我在 http://c3js.org/samples/simple_multiple.html 看到各个点都用与关联线相同的颜色填充。当我创建折线图时,我的点只是空圆圈。如何获得要用线条颜色填充的点?

空圆作为点:

C3 graph with non-filled points

C3代:

                c3.generate({
                    bindto: divReference,
                    data: {
                        x: 'x',
                        columns: columnData,
                        colors: colorData,
                        axes: { data: 'y' },
                    },
                    grid: {
                        x: { show: true },
                        y: { show: true }
                    },
                    axis: {
                        x: {
                            type: 'timeseries',
                            tick: { format: '%m/%d' }
                        }
                    },
                    point: {
                        //stroke: '#ff0000'
                        fill: '#ff0000'
                    }
                })

最佳答案

像这样设置事件“onrendered”,例如:

onrendered: function () {
            var $$ = this;
            var circles = $$.getCircles();
            for(var i = 0; i < circles.length; i++){
                for(var j = 0; j < circles[i].length; j++){
                $$.getCircles(j).style("fill", '#FFF')
                    .style("stroke", $$.color)
                    .style("stroke-width", 3);
                }
            }
        }

https://jsfiddle.net/wfn1s41t/

关于javascript - C3图表点为空圆,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26067106/

相关文章:

javascript - 雅虎网站分析升级

javascript - React-Redux 程序返回 "TypeError: Cannot read property ' map' of undefined"

javascript - 将 Prototype.js 与 C3.js 结合使用

javascript - C3 图表中的特定 JSON 值限制

javascript - 在 Google map 上使用 jQuery 更改鼠标悬停时标记的 labelClass

javascript - .length 在第一次使用 .blur 后停止工作

JavaScript 原语 : same memory location, 新的内存位置,还是依赖于引擎?

javascript - c3.js如何在x/y轴上设置json数据

javascript - 如何重新缩放时间序列的 x 轴(C3js)?

javascript - c3.js。在具有相同类/ID 的多个 div 循环中创建图形?