protorepl

lostineverland 2017-02-23T16:20:47.000685Z

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]]}})

lostineverland 2017-02-23T16:21:01.000686Z

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

lostineverland 2017-02-23T16:21:19.000687Z

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")
      }
    }
  }
}

lostineverland 2017-02-23T16:21:42.000688Z

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"]}}}})

lostineverland 2017-02-23T16:22:26.000689Z

any takers?