Riddari
Riddari

Reputation: 1773

NGX-Charts Color of nodes

I'm trying to understand this 'simple' example of NGX-Charts:

https://stackblitz.com/edit/ngx-graph-simple-example

Each of the nodes in the graph has a different color, and if you look at the component.ts file, the node objects don't have a color field.

But the HTML template for each node uses:

<svg:rect [attr.width]="node.width" [attr.height]="node.height" [attr.fill]="node.options.color" />

Where's node.options.color coming from?

Upvotes: 0

Views: 1463

Answers (1)

M M
M M

Reputation: 725

As per the documentation of @swimlane/ngx-graph library used in the example, the ngx-graph template expects nodes of type Node. Now, looking at the github code of this library, the type Node is an interface with many additional properties.

The version of this library in the example is 4.1.1. This version is quite old as per their github repo, so I couldn't find the coe corresponding to the 4.1.1 version. I would suggest to use the latest version of the library and then you would be able to understand the properties used. Refer the github repo for a better understanding on these properties.

Upvotes: 1

Related Questions