Skip to content

SlicedSilver/lwc-plugin-visible-price-range-util

Repository files navigation

Visible Price Range Util - Lightweight Charts™ Plugin

A plugin for providing a utility API to retrieve the visible range of a price scale, and subscribe to changes.

  • Developed for Lightweight Charts version: v4.1.0

Installation

npm install lwc-plugin-visible-price-range-util

Usage

import { VisiblePriceRangeUtil } from 'lwc-plugin-visible-price-range-util';

// Create an instantiated Visible Price Range Util primitive.
const vprUtil = new VisiblePriceRangeUtil();

// Create the chart and series...
const chart = createChart(document.getElementById('container'));
const lineSeries = chart.addLineSeries();
const data = [
    { time: 1642425322, value: 123 },
    /* ... more data */
];

// Attach the utility to the series
lineSeries.attachPrimitive(vprUtil);

const currentVisiblePriceRange = vprUtil.getVisiblePriceRange();
vprUtil.priceRangeChanged().subscribe(function(newRange) {
    if (!newRange) return;
    console.log(`Price Range is now from ${newRange.bottom} to ${newRange.top}`);
});

Developing

Running Locally

npm install
npm run dev

Visit localhost:5173 in the browser.

Compiling

npm run compile

Check the output in the dist folder.

About

A plugin for providing a utility API to retrieve the visible range of a price scale, and subscribe to changes.

Topics

Resources

Stars

Watchers

Forks

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy