Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 19 additions & 19 deletions plots/highcharts/line/line-basic/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,51 +10,51 @@

from highcharts_core.chart import Chart
from highcharts_core.options import HighchartsOptions
from highcharts_core.options.series.area import LineSeries
from highcharts_core.options.series.area import LineSeries # noqa: E501 - LineSeries is in area module
from selenium import webdriver
from selenium.webdriver.chrome.options import Options


# Data
time_values = ["1", "2", "3", "4", "5", "6", "7"]
data_values = [10, 15, 13, 18, 22, 19, 25]
time_values = [1, 2, 3, 4, 5, 6, 7]
values = [10, 15, 13, 18, 22, 19, 25]

# Create chart
# Create chart with container
chart = Chart(container="container")
chart.options = HighchartsOptions()

# Chart configuration
# Chart settings
chart.options.chart = {"type": "line", "width": 4800, "height": 2700, "backgroundColor": "#ffffff"}

# Title
chart.options.title = {"text": "Basic Line Plot", "style": {"fontSize": "60px"}}
chart.options.title = {"text": "Basic Line Plot", "style": {"fontSize": "40px"}}

# Axes
chart.options.x_axis = {
"title": {"text": "Time", "style": {"fontSize": "48px"}},
"categories": time_values,
"labels": {"style": {"fontSize": "40px"}},
"title": {"text": "Time", "style": {"fontSize": "32px"}},
"categories": [str(t) for t in time_values],
"labels": {"style": {"fontSize": "28px"}},
}
chart.options.y_axis = {
"title": {"text": "Value", "style": {"fontSize": "48px"}},
"labels": {"style": {"fontSize": "40px"}},
"title": {"text": "Value", "style": {"fontSize": "32px"}},
"labels": {"style": {"fontSize": "28px"}},
"gridLineColor": "#e0e0e0",
}

# Legend
chart.options.legend = {"enabled": False}

# Add series
# Create series
series = LineSeries()
series.data = data_values
series.data = values
series.name = "Value"
series.color = "#306998"
series.marker = {"radius": 12, "enabled": True}
series.lineWidth = 6
series.marker = {"enabled": True, "radius": 8}
series.line_width = 4

chart.add_series(series)

# Download Highcharts JS
# Legend
chart.options.legend = {"itemStyle": {"fontSize": "28px"}}

# Download Highcharts JS for inline embedding
highcharts_url = "https://code.highcharts.com/highcharts.js"
with urllib.request.urlopen(highcharts_url, timeout=30) as response:
highcharts_js = response.read().decode("utf-8")
Expand Down
Loading