graphery / graphane

Data Visualization Microframework
MIT License
4 stars 0 forks source link

Accepting simple data #4

Open petergreendr opened 1 month ago

petergreendr commented 1 month ago

I try to run this code:

<g-composer>
  <template>
    <svg viewBox="0 0 100 100">
      <text
        x="50"
        y="50"
        dominant-baseline="middle"
        text-anchor="middle"
        font-family="sans-serif"
        font-size="20"
        g-content="data"
      ></text>
    </svg>
  </template>
  <script type="data">
    [1,2,3]
  </script>
  <script type="methods">
    function data(original) {
      return original[0];
    }
  </script>
</g-composer>

https://playground.graphane.dev/editor/g221b784/

The console shows this error:

composer.js:1 
 Uncaught (in promise) TypeError: Cannot use 'in' operator to search for '$min' in 1
    at n (composer.js:1:22488)
    at Fe (composer.js:1:22809)
    at M.update (composer.js:1:25533)
    at composer.js:1:6969

What is the problem?

pabloalmunia commented 1 month ago

In the current design, data must be an object or array.

Accepting simple data like a number or a string may make sense in some cases. Let's study this possibility and see how to implement it in different situations:

pabloalmunia commented 1 month ago

This new feature has been added in version 1.0.0-beta.3.

Now it's possible:

The data supported are:

Please confirm that this new feature fits your needs.

petergreendr commented 1 month ago

Something is wrong, the example doesn't work.

pabloalmunia commented 1 month ago

Something is wrong, the example doesn't work.

Sorry @petergreendr, it's an error in the Playground, now is fixed. Please try again and don't forget to refresh your browser cache.

petergreendr commented 1 month ago

It's fine now. Congrats.

petergreendr commented 1 month ago

Sorry, the docs need to be updated.