Download web/Chart.js/bar/chart_0066_bar.html from chartact-benchmark/ChartAct: direct link, hf CLI and curl.
- Browser
- Download file 3.56 kB
-
https://huggingface.co/datasets/chartact-benchmark/ChartAct/resolve/main/web/Chart.js/bar/chart_0066_bar.html
- Command line
-
hf download hf://datasets/chartact-benchmark/ChartAct/web/Chart.js/bar/chart_0066_bar.html
-
curl -L -o chart_0066_bar.html https://huggingface.co/datasets/chartact-benchmark/ChartAct/resolve/main/web/Chart.js/bar/chart_0066_bar.html
3.56 kB
| <html lang="en"> | |
| <head> | |
| <meta charset="utf-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1"> | |
| <title>Floating Bars</title> | |
| <style> | |
| :root { | |
| color-scheme: light; | |
| } | |
| body { | |
| margin: 0; | |
| padding: 20px; | |
| font-family: Segoe UI, Arial, sans-serif; | |
| background: #f5f7fb; | |
| color: #1f2a37; | |
| } | |
| h1 { | |
| margin: 0 0 10px 0; | |
| font-size: 20px; | |
| font-weight: 600; | |
| } | |
| #legend-container { | |
| margin-bottom: 8px; | |
| } | |
| #chart-wrap { | |
| position: relative; | |
| width: min(1100px, 100%); | |
| height: 520px; | |
| background: #ffffff; | |
| border: 1px solid #e2e8f0; | |
| border-radius: 10px; | |
| padding: 12px; | |
| box-sizing: border-box; | |
| } | |
| #chart { | |
| width: 100%; | |
| height: 100%; | |
| } | |
| </style> | |
| <script src="./luxon.min.js"></script> | |
| <script src="./chart.umd.min.js"></script> | |
| <script src="./chartjs-adapter-luxon.umd.min.js"></script> | |
| </head> | |
| <body> | |
| <h1>Floating Bars</h1> | |
| <div id="legend-container"></div> | |
| <div id="chart-wrap"> | |
| <canvas id="chart"></canvas> | |
| </div> | |
| <script type="text/plain" data-chart-inline="true"> | |
| const DATA_COUNT = 7; | |
| const NUMBER_CFG = {count: DATA_COUNT, min: -100, max: 100}; | |
| const labels = ["January", "February", "March", "April", "May", "June", "July"]; | |
| const data = { | |
| labels: ["January", "February", "March", "April", "May", "June", "July"], | |
| datasets: [ | |
| { | |
| label: 'Dataset 1', | |
| data: [[78.71742112482855, -7.001886145404669], [-82.27880658436214, -32.915809327846375], [92.32167352537724, -73.85030864197532], [-39.45644718792867, 57.84893689986285], [95.22633744855966, -57.57115912208505], [-27.08676268861454, -91.71553497942386], [-3.926611796982172, -79.15209190672154]], | |
| backgroundColor: Utils.CHART_COLORS.red, | |
| }, | |
| { | |
| label: 'Dataset 2', | |
| data: [[48.65740740740739, 4.8105281207133], [-15.013717421124824, -0.3215020576131593], [51.9735939643347, 48.661694101508914], [44.68106995884773, 20.895919067215374], [-4.7925240054869676, 66.99845679012347], [-5.089163237311396, -92.04303840877915], [-50.03600823045268, 57.351680384087786]], | |
| backgroundColor: Utils.CHART_COLORS.blue, | |
| }, | |
| ] | |
| }; | |
| const config = { | |
| type: 'bar', | |
| data: data, | |
| options: { | |
| responsive: true, | |
| plugins: { | |
| legend: { | |
| position: 'top', | |
| }, | |
| title: { | |
| display: true, | |
| text: 'Chart.js Floating Bar Chart' | |
| } | |
| } | |
| } | |
| }; | |
| function forceEnableHoverTooltip(chartConfig) { | |
| if (!chartConfig || typeof chartConfig !== 'object') { | |
| return; | |
| } | |
| if (!chartConfig.options || typeof chartConfig.options !== 'object') { | |
| chartConfig.options = {}; | |
| } | |
| const options = chartConfig.options; | |
| if (!options.plugins || typeof options.plugins !== 'object') { | |
| options.plugins = {}; | |
| } | |
| const plugins = options.plugins; | |
| if (plugins.tooltip === false) { | |
| plugins.tooltip = {}; | |
| } | |
| if (!plugins.tooltip || typeof plugins.tooltip !== 'object') { | |
| plugins.tooltip = {}; | |
| } | |
| const hasExternalTooltip = typeof plugins.tooltip.external === 'function'; | |
| if (!hasExternalTooltip) { | |
| plugins.tooltip.enabled = true; | |
| } | |
| } | |
| forceEnableHoverTooltip(config); | |
| const sampleCanvas = document.getElementById('chart'); | |
| const sampleChart = new Chart(sampleCanvas, config); | |
| </script> | |
| <script src="./chart_0066_bar.inline01.js"></script> | |
| </body> | |
| </html> | |