This package has been deprecated

Author message:

WARNING: This project has been renamed to 'geostyler-legend'. Install using new-package-name instead.

@terrestris/legend-util
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

legend-util

Greenkeeper badge Build Status Coverage Status

A helper class for rendering legends.

Installation

npm i @terrestris/legend-util

Usage

In order to render a legend, you construct a legend renderer like this:

      const renderer = new LegendRenderer({
        maxColumnWidth: 300,
        maxColumnHeight: 300,
        overflow: 'auto',
        styles: [style],
        size: [600, 300]
      });
      renderer.render(someElement);

The styles property can contain a list of geostyler style objects that each correspond to one legend rendered.

There are currently three modes. If constructed as above, the renderer will render multiple columns if needed, with a maximum width and height as specified. The columns will break on any legend element.

If the overflow property is set to 'group', the columns will break on legend boundaries only, leaving the rest of the column empty if starting on a new legend.

If the maxColumnHeight property is not set, the renderer will render just one column with all the legends, thus ignoring the size parameter for the height.

Development

If you want to contribute, you can build the project like this:

  • git clone https://github.com/terrestris/legend-util
  • cd legend-util
  • npm i

and then either

  • npm run build:dev

in order to get a development build or

  • npm run build:dist

in order to get a production build.

Readme

Keywords

none

Package Sidebar

Install

npm i @terrestris/legend-util

Weekly Downloads

1

Version

0.1.0

License

BSD-2-Clause

Unpacked Size

36.8 kB

Total Files

20

Last publish

Collaborators

  • jansule
  • annarieger
  • terrestris-info
  • marcjansen
  • kaivolland
  • dnlkoch
  • ahennr
  • buehner
  • hwbllmnn
  • lukaslohoff
  • mholthausen
  • jorzekowsky
  • simonseyock
  • hblitza
  • jweskamm