Fork me on GitHub
#protorepl
<
2017-02-23
>
lostineverland16:02:47

I have a formatting issue with the following chart:

(proto-repl-charts.charts/custom-chart
"explore variance"
{:data {
      :xs {:y :x}
      :columns [[:x  -8 -7.5  -7 -6.5  -6 -5.5  -5 -4.5  -4 -3.5 -3]  
                [:y 7.3  7.3 7.1  7.0 7.9  7.9 7.8  7.8 7.7  7.7 7.5]]}})

lostineverland16:02:01

The values for the x-axis are missing the decimal point (even on hover).

lostineverland16:02:19

To specify the formatting, in c3 I would use d3.format(".1f") as follows.

{
  "data" : {
    "xs" : {
      "y" : "x"
    },
    "columns" : [ 
        [ "x",  -8, -7.5,  -7, -6.5,  -6, -5.5,  -5, -4.5,  -4, -3.5, -3 ], 
        [ "y", 7.3,  7.3, 7.1,  7.0, 7.9,  7.9, 7.8,  7.8, 7.7,  7.7, 7.5] 
    ]
  },
  "axis" : {
    "x" : {
      "tick" : {
        "format" : d3.format(".1f")
      }
    }
  }
}

lostineverland16:02:42

My guess for clojure-charts is the following (but it didn't work).

(proto-repl-charts.charts/custom-chart
"explore variance"
{:data {
      :xs {:y :x}
      :columns [[:x  -8 -7.5  -7 -6.5  -6 -5.5  -5 -4.5  -4 -3.5 -3]  
                [:y 7.3  7.3 7.1  7.0 7.9  7.9 7.8  7.8 7.7  7.7 7.5]]}
                
:axis {:x
      { :tick {:format [:format ".1f"]}}}})