Quafadas / dedav4s

Declarative Data Viz 4 Scala
https://quafadas.github.io/dedav4s/
Apache License 2.0
50 stars 4 forks source link

DSL not correctly encoding mark/encode path #21

Closed Quafadas closed 2 years ago

Quafadas commented 2 years ago
import viz.PlotTargets.desktopBrowser
import viz.vega.plots._
val barchart = SpecUrl.BarChart.toDsl() // it decoded successfully!
//val barchart: 
//  Either[io.circe.Error, viz.dsl.vegaLite.VegaLiteDsl | viz.dsl.vega.VegaDsl] = Right(VegaDsl(

barchart.map(_.plot) // need a map right now as it's an either... 

Doesn't plot right now, because mark / encode is a blank case class. https://github.com/Quafadas/dedav4s/blob/b0b4677f9b99bcf76ebb7c01c48a96bff05e731d/core/shared/src/main/scala/viz/dsl/vega.scala#L1604

Think the codegen fails because; vega/vega#3491

Quafadas commented 2 years ago

encode / decode on bar chart spec gets this;

  "marks": [
    {"from": {"data": "table"}, "type": "rect", "encode": {}},
    {"type": "text", "encode": {}}
  ],

for marks.

Quafadas commented 2 years ago

I eyeballed this and did it manually, the correct solution is to generate off the Vega spec itself.