c3.js

C3 stacked chart maintain data order

限于喜欢 提交于 2019-12-06 15:04:19
问题 I'm following the instructions from the reference and from this answer, but am having no success. I've got a stacked bar chart, I want the data in the stack to appear in the order it is in in the data, but it's getting re-ordered and I can't figure out how to prevent it. Here's a jsfiddle. Here's the code var chartOptions = { element: 'chart', data: { "rows":[["0-1","2-3","4-5","6","7"],[25,56,14,2,1],[6,66,27,0,0],[0,70,30,0,0],[27,54,14,5,0],[0,54,30,8,8],[29,64,7,0,0]], "type":"bar",

How to swap out data via unload and load in C3.js

夙愿已清 提交于 2019-12-06 09:54:51
I'm trying to swap out data sets in a C3.js graph. The code I assumed would work based on the C3 docs looks like this: chart.unload(); chart.load({ columns: [ ['data3', 100, 90, 80, 70, 60, 50] ] }); But this doesn't work. You'll notice that the graph rendered on the following Plunkr renders improperly, so I'm clearly doing something wrong: https://jsfiddle.net/7rfm9om9/ What is the idiomatic way to replace data in a C3 chart? According to the c3 documentation, the way to do this is to use the unload param of the load function. chart.load({ unload: true, columns: ['data1', 100] }); There are

Modify Donut Chart Slices in C3/D3

為{幸葍}努か 提交于 2019-12-06 03:24:00
I have created a simple donut chart using c3.js. Here is the FIDDLE . If you hover over a slice of the Donut it will stick out. I was wondering if it is possible for the slice to stick out by default without hovering over. For example i want slice A, slice B, and C to stickout by default How can I do that? Here is my Code var currentSlice; var chart = c3.generate({ data: { x: 'x', columns: [ ['x', '2013-01-01', '2013-01-02', '2013-01-03', '2013-01-04', '2013-01-05', '2013-01-06'], ['A', 30, 200, 100, 400, 150, 250], ['B', 130, 100, 140, 200, 150, 50], ['C', 50, 100, 130, 240, 200, 150], ['D',

C3 Graphs On Load Callback [closed]

拥有回忆 提交于 2019-12-05 19:39:13
Closed . This question needs details or clarity . It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post . Closed last year . I want to use some kind of callback function that will run some code once the C3 Graph is finished loading so that I can change the fill colors of certain points. Don't load any data in the initialization. Rather explicitly call the load event and pass the data in. Then you have access to the done callback. var chart = c3.generate({ /*...*/ }); chart.load({ columns: [['data1, 100, 200, 150, ...], ..

C3.js - Show/hide points independently for a data series

半城伤御伤魂 提交于 2019-12-05 16:47:58
I am creating a line chart for a data series using C3.js. I am struggling in trying to show the "points" only for one of the series. Basically, first I am creating a multiple series line chart with some reference data, and then I am loading (with char.load) a new particular data line in which I want to show points, only for that particular line while the other reference lines remain with hidden points. Is that possible via C3.js? If so, could you instruct me to do so, thanks! Also, any method to do so using D3.js while using C3.js is welcome. This is the official example in which all points

Adding c3.js padding without cutting off graph

假如想象 提交于 2019-12-05 06:16:28
问题 This is in response to the following question, How to remove padding in c3.js?, where the answer that was provided solves this issue, but also raises another issue -- the buttons on the graph are cut off at the end -- How would I get there to be no padding and the buttons not to be cut off, for example, it should look like: 回答1: The dots are getting clipped off because of the clip-path set on the chart layer. You just have to remove it. You can use D3 for this, like so d3.select(chart.element

Is it possible to insert an icon in the arc of a donut chart with D3?

烈酒焚心 提交于 2019-12-05 05:35:40
问题 I have a Donut Chart with 3 categories (arcs): Facebook (50%), Twitter(30%) and Instagram(20%). Plot the chart is fairly easy, but I want to know how to insert an icon in each arc with the respective symbol of the social network (using D3 or even C3). Thanks! 回答1: Adding an image is just a case of using ... .append("svg:image") .attr("xlink:href","myimage.png") .attr("width", "32") .attr("height", "32"); You'll also need to position ( x and y ). These will default to 0, so you could

C3 / D3 bar chart with horizontal scroll

家住魔仙堡 提交于 2019-12-05 01:48:59
问题 I'm working on creating a c3 bar chart where each bar represents the # of people who joined a program in the given week. Data is just an array of objects with [{week, # of people}, {week, # of people}, etc.] Ideally, I want the latest 6 weeks to show in the chart, but I want to be able to scroll horizontally to see past weeks. I saw one answer to this (D3.js scrolling bar chart), but in this case, the axis did not stay visible when scrolling - which I would like to do. Any help would be much

c3js position of data labels

寵の児 提交于 2019-12-05 00:25:08
Is there any possible way to change a positions of labels above the data in c3 bar chart? In official documentation there is well explained how to change positions of labels on x and y measurement axis with manipulation of y and x integer, but I did not found anything for data labels. I've tried to point to it with plain d3 on which c3 is based but console.log returns me null: d3.selectAll(".c3-texts .c3-text").each(function () { var yOrigin = d3.select(this).attr('y'); console.log(yOrigin); }) because it fires before graph generation. You can see and edit what I'm working on here: http:/

How can I add a title to c3.js chart

a 夏天 提交于 2019-12-04 22:48:13
Can any one suggest me the way of adding title to the C3.js line and bar charts ? I have got the following sample but it is for gauge chart. For any c3 chart is there any option to set the chart title? donut: { title: 'Title' } You'd need to fall back to using D3 to add a chart title. Something like: d3.select("svg").append("text") .attr("x", 100 ) .attr("y", 50) .style("text-anchor", "middle") .text("Your chart title goes here"); dbone This was a top google result, so I thought I'd add that this is now part of the library: title: { text: 'My Title' } More info @ https://github.com