Download web/Chart.js/line/chart_0063_line.html from chartact-benchmark/ChartAct: direct link, hf CLI and curl.
- Browser
- Download file 3.75 kB
-
https://huggingface.co/datasets/chartact-benchmark/ChartAct/resolve/main/web/Chart.js/line/chart_0063_line.html
- Command line
-
hf download hf://datasets/chartact-benchmark/ChartAct/web/Chart.js/line/chart_0063_line.html
-
curl -L -o chart_0063_line.html https://huggingface.co/datasets/chartact-benchmark/ChartAct/resolve/main/web/Chart.js/line/chart_0063_line.html
3.75 kB
| <html lang="en"> | |
| <head> | |
| <meta charset="utf-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1"> | |
| <title>Line Chart drawTime</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>Line Chart drawTime</h1> | |
| <div id="legend-container"></div> | |
| <div id="chart-wrap"> | |
| <canvas id="chart"></canvas> | |
| </div> | |
| <script type="text/plain" data-chart-inline="true"> | |
| const inputs = { | |
| min: -100, | |
| max: 100, | |
| count: 8, | |
| decimals: 2, | |
| continuity: 1 | |
| }; | |
| const generateLabels = () => { | |
| return ["January", "February", "March", "April", "May", "June", "July", "August"]; | |
| }; | |
| Utils.srand(3); | |
| const __generatedDataValues = [[-33.81, 86.67, 31.64, 92.46, -24.71, 90.01, -27.57, 39.83], [79.86, 72.78, -53.03, 67.86, 60.16, -36.64, -79.32, 1.24]]; | |
| let __generatedDataIndex = 0; | |
| function generateData() { | |
| const value = __generatedDataValues[__generatedDataIndex] ?? __generatedDataValues[__generatedDataValues.length - 1]; | |
| __generatedDataIndex += 1; | |
| return JSON.parse(JSON.stringify(value)); | |
| } | |
| const data = { | |
| labels: generateLabels(), | |
| datasets: [ | |
| { | |
| label: 'Dataset 1', | |
| data: generateData(), | |
| borderColor: Utils.CHART_COLORS.red, | |
| backgroundColor: Utils.CHART_COLORS.red, | |
| fill: true | |
| }, | |
| { | |
| label: 'Dataset 2', | |
| data: generateData(), | |
| borderColor: Utils.CHART_COLORS.blue, | |
| backgroundColor: Utils.transparentize(Utils.CHART_COLORS.blue), | |
| fill: true | |
| } | |
| ] | |
| }; | |
| const config = { | |
| type: 'line', | |
| data: data, | |
| options: { | |
| plugins: { | |
| filler: { | |
| propagate: false, | |
| }, | |
| title: { | |
| display: true, | |
| text: (ctx) => 'drawTime: ' + ctx.chart.options.plugins.filler.drawTime | |
| } | |
| }, | |
| pointBackgroundColor: '#fff', | |
| radius: 10, | |
| interaction: { | |
| intersect: false, | |
| } | |
| }, | |
| }; | |
| 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_0063_line.inline01.js"></script> | |
| </body> | |
| </html> | |