Plugins
You can add auxiliary elements to your chart using plugins (via the plugins keyword).
LightweightCharts.LWCPlugin — TypeVertical line
LightweightCharts.Plugins.lwc_vert_line — Functionlwc_vert_line(index::Int64; kw...) -> LWCPluginAdds a vertical line based on index to the chart.
Keyword arguments
| Name::Type | Default (Possible values) | Description | 
|---|---|---|
| label_text::String | "" | Vertical line label. | 
| width::Float64 | 3.0 | Vertical line width. | 
| color::String | Random color | Color of the vertical line. | 
| label_background_color::String | Random color | Label background color. | 
| label_text_color::String | "white" | Label text color. | 
| show_label::Bool | false | Label visibility. | 
Examples
using LightweightCharts
t_values = round(Int64, time()) .+ collect(0:300)
x_values = map(x -> 1/(x - 250), 0:300)
chart = lwc_line(
    t_values,
    x_values;
    line_color = "#7678ed",
    label_name = "hyperbola",
    price_scale_id = LWC_RIGHT,
    plugins = [
        lwc_vert_line(
            250;
            color = "#f18701",
            label_background_color = "#f35b04",
            show_label = true,
            label_text = "lwc_vert_line",
        ),
    ],
)
lwc_save("vert_line_example.html", chart)Tooltip
LightweightCharts.Plugins.lwc_tooltip — Functionlwc_vert_line(; kw...) -> LWCPluginAdds a dynamic tooltip to the chart following the cursor and displaying the values.
Keyword arguments
| Name::Type | Default (Possible values) | Description | 
|---|---|---|
| line_color::String | "rgba(0, 0, 0, 0.2)" | Tooltip line color. | 
| title::String | "" | Tooltip title. | 
| follow_mode::LWC_TOOLTIP_TYPE | LWC_TOOLTIP_TOP(LWC_TOOLTIP_TRACK) | Tooltip Location. | 
| horizontal_deadzone_width::Int64 | 45 | |
| vertical_deadzone_height::Int64 | 100 | Horizontal deadzone height. | 
| vertical_spacing::Int64 | 20 | Vertical spacing. | 
| top_offset::Int64 | 20 | Vertical offset for tooltip. | 
Examples
using LightweightCharts
t_values = round(Int64, time()) .+ collect(1:300)
x_values = map(x -> cos(x / 10), 1:300)
chart = lwc_line(
    t_values,
    x_values;
    line_color = "#0fa3b1",
    label_name = "cos",
    line_type = LWC_STEP,
    line_width = 2,
    price_scale_id = LWC_RIGHT,
    plugins = [
        lwc_tooltip(;
            line_color = "#7400b8",
            follow_mode = LWC_TOOLTIP_TRACK,
        ),
    ],
)
lwc_save("tooltip_example.html", chart)Delta tooltip
LightweightCharts.Plugins.lwc_delta_tooltip — Functionlwc_vert_line(; kw...) -> LWCPluginAdds a dynamic tooltip to the chart following the cursor and displaying the values (and their change, while holding down the mouse button).
Keyword arguments
| Name::Type | Default (Possible values) | Description | 
|---|---|---|
| line_color::String | "rgba(0, 0, 0, 0.2)" | Line color. | 
| show_time::Bool | false | Detailed time display. | 
| top_offset::Int64 | 20 | Vertical offset for tooltip. | 
Examples
using LightweightCharts
t_values = round(Int64, time()) .+ collect(1:300)
x_values = map(x -> sin(x / 10), 1:300)
chart = lwc_line(
    t_values,
    x_values;
    line_color = "#90be6d",
    label_name = "sin",
    line_width = 2,
    price_scale_id = LWC_RIGHT,
    plugins = [
        lwc_delta_tooltip(;
            show_time = true,
            top_offset = 10,
        ),
    ],
)
lwc_save("delta_tooltip_example.html", chart)Trend line
LightweightCharts.Plugins.lwc_trend_line — Functionlwc_trend_line(start_index, start_price, end_index, end_price; kw...) -> LWCPluginAdds a trend line to the chart starting with start_index and start_price and ending with end_index and end_price.
Keyword arguments
| Name::Type | Default (Possible values) | Description | 
|---|---|---|
| line_color::String | Random color | Line color. | 
| width::Int64 | 6 | Line width. | 
| show_labels::Bool | true | Labels visibility. | 
| label_background_color::String | "rgba(255, 255, 255, 0.85)" | Label background color. | 
| label_text_color::String | "rgb(0, 0, 0)" | Label text color. | 
Examples
using LightweightCharts
t_values = round(Int64, time()) .+ collect(1:300)
x_values = map(x -> cos(x / 10), 1:300)
chart = lwc_line(
    t_values,
    x_values;
    line_color = "#c77dff",
    label_name = "cos",
    price_scale_id = LWC_RIGHT,
    plugins = [
        lwc_trend_line(
            220,
            -0.7,
            250,
            1.3;
            line_color = "#ff6700",
        ),
    ],
)
lwc_save("trend_line_example.html", chart)Crosshair bar
LightweightCharts.Plugins.lwc_crosshair_highlight_bar — Functionlwc_crosshair_highlight_bar(; kw...) -> LWCPluginAdds additional highlighting to the cursor crosshairs.
Keyword arguments
| Name::Type | Default (Possible values) | Description | 
|---|---|---|
| color::String | "rgba(0, 0, 0, 0.2)" | Crosshair highlight color. | 
Examples
using LightweightCharts
t_values = round(Int64, time()) .+ collect(1:300)
x_values = map(x -> cos(x / 10), 1:300)
chart = lwc_line(
    t_values,
    x_values;
    line_color = "#0a9396",
    label_name = "cos",
    price_scale_id = LWC_RIGHT,
    plugins = [
        lwc_crosshair_highlight_bar(;
            color = "#94d2bd",
        ),
    ],
)
lwc_save("crosshair_bar_example.html", chart)