Thanks to visit codestin.com
Credit goes to github.com

Skip to content

export! error with png #189

@mars0i

Description

@mars0i

I've been using oz a lot--thanks! My use is very simple: I just create individual plots one at a time.

Using oz 2.0.0-alpha5, I can open my vega-lite specs in a browser using view! and then save to png or svg, and I can use export! to save to an svg file, but not to a png file. I've tried saving to a png with a full file path beginning from /, and using :toformat :png, but the error seems to be the same, as in this example:

user=> (oz/export! plot "~/yo.png")
22-04-22 14:51:19 cas-C02DR190MD6R INFO [oz.core:432] - input: /var/folders/68/d0l7z7p906l07fj6s7j5_ygm0000gq/T/de864d61-7a31-4066-82e8-8f7288a3577c5750598409336618572.vl.json
22-04-22 14:51:19 cas-C02DR190MD6R INFO [oz.core:433] - output: ~/yo.png
22-04-22 14:51:19 cas-C02DR190MD6R ERROR [oz.core:442] - Problem creating output
22-04-22 14:51:19 cas-C02DR190MD6R ERROR [oz.core:443] - /usr/local/lib/node_modules/vega/node_modules/vega-label/build/vega-label.js:593
      let textWidth = d.textWidth ?? 0,
                                   ^

SyntaxError: Unexpected token ?
    at createScript (vm.js:80:10)
    at Object.runInThisContext (vm.js:152:10)
    at Module._compile (module.js:624:28)
    at Object.Module._extensions..js (module.js:671:10)
    at Module.load (module.js:573:32)
    at tryModuleLoad (module.js:513:12)
    at Function.Module._load (module.js:505:3)
    at Module.require (module.js:604:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/usr/local/lib/node_modules/vega/build/vega-node.js:13:13)

"/usr/local/lib/node_modules/vega/node_modules/vega-label/build/vega-label.js:593\n      let textWidth = d.textWidth ?? 0,\n                                   ^\n\nSyntaxError: Unexpected token ?\n    at createScript (vm.js:80:10)\n    at Object.runInThisContext (vm.js:152:10)\n    at Module._compile (module.js:624:28)\n    at Object.Module._extensions..js (module.js:671:10)\n    at Module.load (module.js:573:32)\n    at tryModuleLoad (module.js:513:12)\n    at Function.Module._load (module.js:505:3)\n    at Module.require (module.js:604:17)\n    at require (internal/module.js:11:18)\n    at Object.<anonymous> (/usr/local/lib/node_modules/vega/build/vega-node.js:13:13)\n"

In case it's relevant:

  • plot is a vega-lite spec created using Hanami. The spec uses vega-lite's "concat" operator to display nine plots on a grid. The plots use "order" to create paths that don't just go from left to right but in any direction. I'm mentioning that just because it's uncommon. Works fine with view! in the browser, and works fine with svg files despite some warning messages ('WARN Missing type for channel "order", using "quantitative" instead.')
  • plot is huge. I'm going to do something to reduce the amount of data lines in it--that's my next task--but I am avoiding simply throwing away points to reduce the amount of data in the spec. (Just taking every fifth or tenth point won't work in this case, and I'd need to write something more sophisticated.)

I recognize that this might not be an oz error, but rather an error in the lib that export! calls, but I thought I should ask about it here first.

Thanks-

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions