Grapper View
Grapper is based on the custom tag <grapper-view></grapper-view>. This web component is the main element of Grapper and everything happens inside it. We will include the other elements in a nested way.
The component grapper-view can include:
| name | description | tag |
|---|---|---|
| template | defines the SVG powered by directives | <template></template> |
| data | data in format CSV, JSON or JSON5 | <script type="data"></script> |
| methods | Optionally, can include Javascript functions to manage events and data transformation | <script type="methods"></script> |
Using external resources instead including the code in the component
In all our examples we will include the code directly inside grapper-view. In practice, we can create separate files for each of the elements and link them by the attributes:
- The
svg-srcattribute specifies the path to the SVG template. - The
data-srcattribute indicates the location of the data source. - The
methods-srcattribute indicates the location of methods.