Coder Social home page Coder Social logo

Fail with Layered Spec about react-vega HOT 14 CLOSED

vega avatar vega commented on August 22, 2024
Fail with Layered Spec

from react-vega.

Comments (14)

domoritz avatar domoritz commented on August 22, 2024

Could you provide an example that doesn't work?

from react-vega.

shenenya avatar shenenya commented on August 22, 2024

Try this: https://vega.github.io/vega-lite/examples/wheat_wages.html.

from react-vega.

domoritz avatar domoritz commented on August 22, 2024

I made a simple layered spec and it worked. Please provide more details about what doesn't work.

Screen Shot 2019-10-15 at 11 03 33

from react-vega.

shenenya avatar shenenya commented on August 22, 2024

Do you try layer spec with multi datasets? I modify the vegalite demo in react-vega as follows, which do not work.

const data1 = {
myData: [
{ a: "A", b: 20 },
{ a: "B", b: 34 },
{ a: "C", b: 55 },
{ a: "D", b: 19 },
{ a: "E", b: 40 },
{ a: "F", b: 34 },
{ a: "G", b: 91 },
{ a: "H", b: 78 },
{ a: "I", b: 25 }
]
};

const spec1 = {
description: "A simple bar chart with embedded data.",
layer: [
{
data: { name: "myData" },
encoding: {
x: { field: "a", type: "ordinal" },
y: { field: "b", type: "quantitative" }
},
mark: "bar"
}
]
};

from react-vega.

domoritz avatar domoritz commented on August 22, 2024

What does not work?

from react-vega.

shenenya avatar shenenya commented on August 22, 2024

I do not know. This is the result of spec as above.
截屏2019-10-16上午9 32 16

from react-vega.

shenenya avatar shenenya commented on August 22, 2024

BTW. The following code works fine.
截屏2019-10-16上午9 52 33

from react-vega.

domoritz avatar domoritz commented on August 22, 2024

Can you give me a fully working example including the call to React-Vega?

from react-vega.

shenenya avatar shenenya commented on August 22, 2024

Yes. Based on the demo https://github.com/vega/react-vega/tree/master/packages/react-vega-demo/stories, I only change the 'spec1' in file ReactVegaLiteDemo.jsx to:

const spec1 = { description: "A simple bar chart with embedded data.", layer: [ { data: { name: "myData" }, encoding: { x: { field: "a", type: "ordinal" }, y: { field: "b", type: "quantitative" } }, mark: "bar" } ] };

It failed.

If I change spec1 to follow, it work fine.

const spec1 = { description: "A simple bar chart with embedded data.", layer: [ { data: { values: [ { a: "A", b: 28 }, { a: "B", b: 55 }, { a: "C", b: 43 }, { a: "D", b: 91 }, { a: "E", b: 81 }, { a: "F", b: 53 }, { a: "G", b: 19 }, { a: "H", b: 87 }, { a: "I", b: 52 } ] }, encoding: { x: { field: "a", type: "ordinal" }, y: { field: "b", type: "quantitative" } }, mark: "bar" } ] };

from react-vega.

domoritz avatar domoritz commented on August 22, 2024

The second example explicitly provides the data. Can you start debugging there? I don’t think the problem is layering.

from react-vega.

shenenya avatar shenenya commented on August 22, 2024

I think the problem comes from that react-vega or vega-embed do not deal with input data correctly in layered chart. But I am not sure, and I do not know how to debug that.

from react-vega.

domoritz avatar domoritz commented on August 22, 2024

Vega-Embed definitely supports multiple datasets. @kristw could help with how we handle multiple datasets in react vega.

from react-vega.

kristw avatar kristw commented on August 22, 2024

See #66

from react-vega.

shenenya avatar shenenya commented on August 22, 2024

Great. Looking forward to the next release with this feature.

from react-vega.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.