Py.Cafe

namakshenas/

dash-echarts-heatmap

Interactive Color-Themed Heatmap with Dash and ECharts

DocsPricing
  • assets/
  • app.py
  • requirements.txt
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# Code belongs to yazid - https://github.com/leberber
from dash import  Dash, dcc, html, Input, Output, clientside_callback, ClientsideFunction
import dash_mantine_components as dmc


app = Dash(__name__, external_scripts=['https://cdn.jsdelivr.net/npm/echarts/dist/echarts.min.js'])
app.layout = dmc.MantineProvider(
    theme={
        "colors": {
            "myColor": [                
              "#F2FFB6",
              "#DCF97E",
              "#C3E35B",
              "#AAC944",
              "#98BC20",
              "#86AC09",
              "#78A000",
              "#668B00",
              "#547200",
              "#455D00",                
            ]
        },
    },
    children=[
        html.Button("Click me", id="button"),
        html.Div(id="emchart-container", style={"width": "800px", "height": "800px"}),  # Set dimensions
    ]
)






clientside_callback(
    ClientsideFunction(
        namespace='emChart',
        function_name='heatMap'
    ),
    Output("emchart-container", "children"),
    Input("button", "n_clicks"),
)


if __name__ == "__main__":
    app.run_server(debug=True)