Skip to main content

Function: withAttribution()

withAttribution<F>(chartOptions?, o?): F & object

Defined in: packages/sdvplot/src/lightweight-charts.ts:66

Chart options for createChart with TradingView's attribution logo on (layout.attributionLogo: true), the library's own link to https://www.tradingview.com/ that its licence asks for. The options are copied, never changed; the rest of them is kept. A layout.attributionLogo: false in them is turned back on, with one warning: only the explicit { attributedElsewhere: true } turns it off, and the licence is then the caller's to meet.

Type Parameters​

F​

F extends object = Record<never, never>

Parameters​

chartOptions?​

F

o?​

AttributionOptions = {}

Returns​

F & object

Example​

import { attributionNotice, withAttribution } from "@sportsdataverse/sdvplot/lightweight-charts";
import { createChart } from "lightweight-charts";

const el = document.body.appendChild(document.createElement("div"));
// the chart, with TradingView's logo (its link) on it, and TradingView's notice on the page
const chart = createChart(el, withAttribution({ width: 640, height: 320 }));
const notice = attributionNotice(el.parentElement ?? el);
[chart.options().layout.attributionLogo, notice.textContent];