C3: Custom shapes for points

Created on 20 Mar 2015  ·  47Comments  ·  Source: c3js/c3

It would be great to be able to define different shapes (circle, square, triangle, star, ...) for the graph points.

They are 2 main reason for that:

  • Printing on a grey scale printer
  • Color blind people

Some topic were create on google group without response:
https://groups.google.com/d/topic/c3js/I2UhY4U6zI0/discussion
https://groups.google.com/d/topic/c3js/gZrpl0QpKYw/discussion
https://groups.google.com/d/topic/c3js/6QRQ1VWx3vw/discussion

Legend should use the same shape as the one define for the points.

Here is how I imagine the configuration:

point: {
  shape: {
    'data1': 'circle',
    'data2': 'square',
    'data3': 'triangle'
  }
}

or, in order to define some other custom attributes:

point: {
  'data1': {
    shape: 'circle',
    color: '#ff0000',
    r: 2
  },
  'data2': {
    shape: 'square',
    color: '#0000ff',
    r: 3
  }
}
C-feature-request R-needs-docs

Most helpful comment

Everyone who wants this feature, please either subscribe yourself or use an emoji response instead of replying +1.

Thanks.

All 47 comments

I would really appreciate this feature.

+1

major +1

+1

+1
Did anyone found a way to achieve this ?

I worked on implementing custom shapes for plot points. I have implemented square and rectangle shapes.
Here is my work :
https://github.com/prakulgupta/c3.js-CustomPlotPointShapes-Feature.git

Hope this may help folks who need custom shape feature :+1:

Thanks @prakulgupta !
To achieve different shapes I had to run a d3 function after the chart is built that straight up changed the circles to squares.. Makes me feel gross. My plan was to just rebuild our scatter plot with straight d3. Will try that repo out!

+1 would love to see this integrated as well.

+1 badly needed

+1 would be awesome!

@prakulgupta That looks like a really good candidate for a pull request! Would you maybe consider doing so? Thanks!

i want a triangle shape :( , or an arrow mark. To show the point in bar chart.

+1

+1

👍

I found the solution for this. Use d3. It's way easier than you might imagine. Ex: http://bl.ocks.org/bunkat/2595950

I would say that this is not really a solution.
We are using the hole bunch of functions that c3 provides. Rewrite them using the native d3 library is not very useful.

+1, it would also be great to have point types for legend

+1 !

+1

👍

+1

Everyone who wants this feature, please either subscribe yourself or use an emoji response instead of replying +1.

Thanks.

Something like a switch mode between these two types of displaying the graphs would be neat.

Could you use something like https://github.com/d3/d3-shape#symbols to accomplish this?

For another solution with scatter chart, see here: http://stackoverflow.com/a/41848255/1178015

+1

👍

👍

+1

+1

What's the status on this issue/request? This is really the only thing that is preventing me from using C3js and I'd love to. A11y is huge concern and the points about printing and color blindness is valid. I added a thumbs up last year but the thread has become silent in terms of a solution. Is this something that might be in current development or is this request being denied?

Thanks for all the amazing work and hope that a resolution is possible.

It would also be useful if it allowed more than symbols, e.g. images or svg.
For example, highlighting certain datasets based on some attributes, would be really neat.

It would be even more awesome if it could allow to set a specific shape to a specific point of a dataset.
Exemple application: On a wind speed graph (date in x, speed in y), it would allow to show the direction of the wind on each value (directional arrow as a point shape).

+1

👍

👍

Please upvote the comment that you like, instead of commenting +1 or thumbs up, it makes it easier to follow the issue by not spamming anyone's inbox and only sending messages about relevant input

👍

👍

👍

👍

Can someone with deeper knowledge of the c3 codebase comment on how one could implement this change? Given such guidance, perhaps someone from the community would volunteer to take on this task.

Any progress expected on this? This is nearly a 4 year old issue as of this writing.

@BrandKNY This project is not maintened anymore. billboard.js is the new active branch, but this feature is not ready in billboard.js neither

(this issue is old/2015! but no point style exists at https://c3js.org/reference.html )

Perhaps the first step is to include a little enhance instead a big jump to "any shape"... Suggestion: as in data.colors, definition per dataset, offer option to define circle radius as object,

 point: { 
    r: { data1: 5,   data2: 2.5 } 
} 
Was this page helpful?
0 / 5 - 0 ratings