c3js, keep x axis tick values and remove points
Asked Answered
T

1

6

I have this chart, with an x axis that loads close to a thousand timeseries points.

These points are unattractive.

enter image description here

I could hide the x axis, but I want the dates to appear underneath, minus the tick points.

Is there a way to remove tick points while leaving the times. (Please ignore numbers on x axis I know they're wrong).

Preferably, I would like this to be a category line chart and avoid timeseries entirely.

Code, with removed data for simplicity -

var chart = c3.generate({
        padding: {
            right: 30
        },
        data: {
          x: 'x',
          columns: [
                ['x',1324252800,1324339200],
                ['OECD Crude Oil Price',102.91,105.05]         
          ],
          type: 'line',
          onclick: function (d, element) { console.log("onclick", d, element); },
          onmouseover: function (d) { console.log("onmouseover", d); },
          onmouseout: function (d) { console.log("onmouseout", d); },
          order: null
        },
        point: {
            show: false
        },
        axis: {
          x: {

            //show:false, 
            //I don't want this, I want to see the dates

            type: 'timeseries',
            tick: {
                culling: {
                    max: 3 
                },
                multiline: false
            }
          },
          y: {
            tick: {
                format: function (d) { return  "$ " + d ; }
            }
          }
        },  
      });

Thanks in advance

Translunar answered 23/12, 2014 at 2:8 Comment(0)
T
4

Okay, wow, silly of me. I've found this solution to a problem previously.

Here is my answer just a fortnight ago.

Facepalm.

Here's what the chart looks like now, with the desired effect -

enter image description here

Translunar answered 23/12, 2014 at 3:51 Comment(1)
Here is another example. Edit the tick's line in css -- .tick line{ opacity: 0; }Translunar

© 2022 - 2024 — McMap. All rights reserved.