ChartView
Base abstract class for all chart view components. Provides common functionality for rendering charts, handling drawing tools, cursors, and user interactions.ViewProps
Interface for chart view component properties.Name identifier for the view
Unique identifier for the view instance
X-coordinate position of the view
Y-coordinate position of the view
Width of the view in pixels
Height of the view in pixels
X-axis control for managing horizontal chart coordinates and time
Time series variable containing the chart data
Event object for triggering view updates
Drawing update configuration for managing drawing tools
Main indicator outputs for indicator chart views
Index of the indicator in stacked layout
Array of indicators to overlay on the chart
Constants
Width of the Y-axis area (55 pixels)
Height of control elements (12 pixels)
Height per line of title text (14 pixels)
Methods
Computes the chart geometry including max/min values and Y-axis scaling. Called before rendering to ensure proper coordinate mapping.
Returns the chart width (total width minus axis width)
Abstract method to get the value at a specific time. Must be implemented by subclasses.
plot
() => Pick<ViewState, 'chartLines' | 'chartAxisy' | 'gridLines' | 'overlayChartLines' | 'drawingLines'>
Abstract method to plot the chart. Returns JSX elements for rendering.
KlineView
Chart view component for displaying candlestick/kline data with support for overlays and drawings.Example Usage
Props
Inherits all props fromViewProps. The tvar prop should be of type TVar<Kline>.
Methods
Renders the kline chart with PlotKline component and any overlay indicators.
Computes the maximum high and minimum low values across all visible klines.Returns:
[maxValue, minValue]Returns the close price of the kline at the specified time.Source:
KlineView.tsx:229Switches between LINEAR, LG (logarithmic), and LN (natural log) Y-axis scaling.
Overlay Support
KlineView supports multiple overlay plot types:style_line/line- Line plots (PlotLine)style_linebr/style_stepline- Step line plots (PlotStepLine)style_circles/style_cross- Circle/cross markers (PlotCrossCircles)shape/char- Shape markers (PlotShape)hline- Horizontal lines (PlotHline)fill- Fill between plots (PlotFill)background- Background color (PlotBgcolor)drawing_line- Drawing lines (PlotDrawingLine)
KlineView.tsx:67-188
IndicatorView
Chart view component for displaying technical indicators in a separate pane.Example Usage
Props
Inherits all props fromViewProps. The tvar prop should be of type TVar<PineData[]> and mainIndicatorOutputs is required.
Methods
Renders the indicator based on the plot style specified in
mainIndicatorOutputs.Computes the maximum and minimum values from all indicator outputs across visible bars.Returns:
[maxValue, minValue]Returns
undefined - indicator views don’t show cursor values for time.Source: IndicatorView.tsx:203Supported Plot Styles
style_histogram/style_columns- Histogram/column plots (PlotHistogram)style_circles/style_cross- Circle/cross markers (PlotCrossCircles)shape/char- Shape markers (PlotShape)hline- Horizontal lines (PlotHline)fill- Fill between plots (PlotFill)background- Background color (PlotBgcolor)drawing_line- Drawing lines (PlotDrawingLine)line/dashed- Line plots (PlotLine)
IndicatorView.tsx:38-142
VolumeView
Chart view component for displaying trading volume as a histogram.Example Usage
Props
Inherits all props fromViewProps. The tvar prop should be of type TVar<Kline>.
Methods
Renders the volume histogram using PlotVolume component.
Computes the maximum volume across visible bars. Minimum is always 0.Returns:
[maxVolume, 0]Source: VolumeView.tsx:49-74Returns the volume of the kline at the specified time.Source:
VolumeView.tsx:88Notes
- Volume view always uses a minimum value of 0
- Shares the same kline data as KlineView but displays volume property
- Supports LINEAR and LG (logarithmic) Y-axis scaling