Download web/Chart.js/scatter/chart_0051_scatter.html from chartact-benchmark/ChartAct: direct link, hf CLI and curl.
- Browser
- Download file 4.33 kB
-
https://huggingface.co/datasets/chartact-benchmark/ChartAct/resolve/main/web/Chart.js/scatter/chart_0051_scatter.html
- Command line
-
hf download hf://datasets/chartact-benchmark/ChartAct/web/Chart.js/scatter/chart_0051_scatter.html
-
curl -L -o chart_0051_scatter.html https://huggingface.co/datasets/chartact-benchmark/ChartAct/resolve/main/web/Chart.js/scatter/chart_0051_scatter.html
4.33 kB
| <html lang="en"> | |
| <head> | |
| <meta charset="utf-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1"> | |
| <title>Scatter - Multi axis</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>Scatter - Multi axis</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, rmin: 1, rmax: 1, min: -100, max: 100}; | |
| const data = { | |
| datasets: [ | |
| { | |
| label: 'Dataset 1', | |
| data: [{x: 86.04423868, y: 87.87722908, r: 1}, {x: 54.47187929, y: 89.4324417, r: 1}, {x: 12.81721536, y: -42.55144033, r: 1}, {x: -88.30246914, y: -31.53120713, r: 1}, {x: 72.10048011, y: -75.03772291, r: 1}, {x: 7.60631001, y: -89.12037037, r: 1}, {x: -20.05658436, y: -19.45816187, r: 1}], | |
| borderColor: Utils.CHART_COLORS.red, | |
| backgroundColor: Utils.transparentize(Utils.CHART_COLORS.red, 0.5), | |
| yAxisID: 'y', | |
| }, | |
| { | |
| label: 'Dataset 2', | |
| data: [{x: -96.48748285, y: -13.07013032, r: 1}, {x: -13.75943073, y: 53.40277778, r: 1}, {x: 39.13323045, y: -63.04612483, r: 1}, {x: -39.04406722, y: 84.49674211, r: 1}, {x: -90.26663237, y: 91.093107, r: 1}, {x: 58.30504115, y: -11.15826475, r: 1}, {x: 83.21416324, y: 69.10065158, r: 1}], | |
| borderColor: Utils.CHART_COLORS.orange, | |
| backgroundColor: Utils.transparentize(Utils.CHART_COLORS.orange, 0.5), | |
| yAxisID: 'y2', | |
| } | |
| ] | |
| }; | |
| const config = { | |
| type: 'scatter', | |
| data: data, | |
| options: { | |
| responsive: true, | |
| plugins: { | |
| legend: { | |
| position: 'top', | |
| }, | |
| title: { | |
| display: true, | |
| text: 'Chart.js Scatter Multi Axis Chart' | |
| } | |
| }, | |
| scales: { | |
| y: { | |
| type: 'linear', // only linear but allow scale type registration. This allows extensions to exist solely for log scale for instance | |
| position: 'left', | |
| ticks: { | |
| color: Utils.CHART_COLORS.red | |
| } | |
| }, | |
| y2: { | |
| type: 'linear', // only linear but allow scale type registration. This allows extensions to exist solely for log scale for instance | |
| position: 'right', | |
| reverse: true, | |
| ticks: { | |
| color: Utils.CHART_COLORS.blue | |
| }, | |
| grid: { | |
| drawOnChartArea: false // only want the grid lines for one axis to show up | |
| } | |
| } | |
| } | |
| }, | |
| }; | |
| 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_0051_scatter.inline01.js"></script> | |
| </body> | |
| </html> | |