|
15 | 15 | from selenium.webdriver.chrome.options import Options |
16 | 16 |
|
17 | 17 |
|
18 | | -# Data |
19 | | -months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"] |
20 | | -sales = [100, 150, 130, 180, 200, 220, 195, 240, 260, 230, 270, 310] |
| 18 | +# Data - Monthly sales example |
| 19 | +sales = [100, 150, 130, 180, 200, 220, 195, 240, 280, 310, 290, 350] |
21 | 20 |
|
22 | 21 | # Create chart |
23 | 22 | chart = Chart(container="container") |
24 | 23 | chart.options = HighchartsOptions() |
25 | 24 |
|
26 | 25 | # Chart configuration |
27 | | -chart.options.chart = {"type": "area", "width": 4800, "height": 2700, "backgroundColor": "#ffffff"} |
| 26 | +chart.options.chart = { |
| 27 | + "type": "area", |
| 28 | + "width": 4800, |
| 29 | + "height": 2700, |
| 30 | + "backgroundColor": "#ffffff", |
| 31 | + "style": {"fontFamily": "Arial, sans-serif"}, |
| 32 | +} |
28 | 33 |
|
29 | 34 | # Title |
30 | | -chart.options.title = {"text": "Monthly Sales Overview", "style": {"fontSize": "48px"}} |
| 35 | +chart.options.title = {"text": "Monthly Sales Trend", "style": {"fontSize": "48px"}} |
31 | 36 |
|
32 | 37 | # Axes |
33 | 38 | chart.options.x_axis = { |
34 | | - "categories": months, |
35 | | - "title": {"text": "Month", "style": {"fontSize": "36px"}}, |
36 | | - "labels": {"style": {"fontSize": "28px"}}, |
| 39 | + "title": {"text": "Month", "style": {"fontSize": "40px"}}, |
| 40 | + "categories": ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], |
| 41 | + "labels": {"style": {"fontSize": "32px"}}, |
| 42 | + "gridLineWidth": 1, |
| 43 | + "gridLineColor": "rgba(0, 0, 0, 0.1)", |
37 | 44 | } |
38 | 45 |
|
39 | 46 | chart.options.y_axis = { |
40 | | - "title": {"text": "Sales ($)", "style": {"fontSize": "36px"}}, |
41 | | - "labels": {"style": {"fontSize": "28px"}}, |
42 | | - "gridLineColor": "#e0e0e0", |
| 47 | + "title": {"text": "Sales ($)", "style": {"fontSize": "40px"}}, |
| 48 | + "labels": {"style": {"fontSize": "32px"}}, |
43 | 49 | "gridLineWidth": 1, |
| 50 | + "gridLineColor": "rgba(0, 0, 0, 0.1)", |
44 | 51 | } |
45 | 52 |
|
46 | | -# Add series |
| 53 | +# Legend |
| 54 | +chart.options.legend = {"enabled": False} |
| 55 | + |
| 56 | +# Create area series |
47 | 57 | series = AreaSeries() |
48 | 58 | series.data = sales |
49 | 59 | series.name = "Sales" |
50 | 60 | series.color = "#306998" |
51 | 61 | series.fill_opacity = 0.5 |
52 | 62 | series.line_width = 4 |
| 63 | +series.marker = {"enabled": True, "radius": 6, "fillColor": "#306998", "lineWidth": 2, "lineColor": "#ffffff"} |
53 | 64 |
|
54 | 65 | chart.add_series(series) |
55 | 66 |
|
56 | | -# Legend |
57 | | -chart.options.legend = {"enabled": False} |
58 | | - |
59 | | -# Credits |
60 | | -chart.options.credits = {"enabled": False} |
61 | | - |
62 | 67 | # Download Highcharts JS |
63 | 68 | highcharts_url = "https://code.highcharts.com/highcharts.js" |
64 | 69 | with urllib.request.urlopen(highcharts_url, timeout=30) as response: |
|
0 commit comments