Download web/Chart.js/line/chart_0079_line.html from chartact-benchmark/ChartAct: direct link, hf CLI and curl.
- Browser
- Download file 3.8 kB
-
https://huggingface.co/datasets/chartact-benchmark/ChartAct/resolve/main/web/Chart.js/line/chart_0079_line.html
- Command line
-
hf download hf://datasets/chartact-benchmark/ChartAct/web/Chart.js/line/chart_0079_line.html
-
curl -L -o chart_0079_line.html https://huggingface.co/datasets/chartact-benchmark/ChartAct/resolve/main/web/Chart.js/line/chart_0079_line.html
3.8 kB
| <html lang="en"> | |
| <head> | |
| <meta charset="utf-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1"> | |
| <title>Tick Configuration</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>Tick Configuration</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 = 12; | |
| const NUMBER_CFG = {count: DATA_COUNT, min: 0, max: 100}; | |
| const data = { | |
| labels: [['June', '2015'], 'July', 'August', 'September', 'October', 'November', 'December', ['January', '2016'], 'February', 'March', 'April', 'May'], | |
| datasets: [ | |
| { | |
| label: 'Dataset 1', | |
| data: [24.91855281, 13.65912209, 13.40792181, 29.10322359, 28.646262, 20.67901235, 99.02863512, 53.81858711, 49.24639918, 68.02812071, 22.50943073, 32.44341564], | |
| fill: false, | |
| borderColor: Utils.CHART_COLORS.red, | |
| backgroundColor: Utils.transparentize(Utils.CHART_COLORS.red, 0.5), | |
| }, | |
| { | |
| label: 'Dataset 2', | |
| data: [69.43501372, 68.0521262, 3.60339506, 36.58264746, 23.78000686, 96.05967078, 2.80435528, 23.02640604, 43.14557613, 1.43347051, 99.12465706, 78.19444444], | |
| fill: false, | |
| borderColor: Utils.CHART_COLORS.blue, | |
| backgroundColor: Utils.transparentize(Utils.CHART_COLORS.blue, 0.5), | |
| } | |
| ] | |
| }; | |
| const config = { | |
| type: 'line', | |
| data: data, | |
| options: { | |
| responsive: true, | |
| plugins: { | |
| title: { | |
| display: true, | |
| text: 'Chart with Tick Configuration' | |
| } | |
| }, | |
| scales: { | |
| x: { | |
| ticks: { | |
| // For a category axis, the val is the index so the lookup via getLabelForValue is needed | |
| callback: function(val, index) { | |
| // Hide every 2nd tick label | |
| return index % 2 === 0 ? this.getLabelForValue(val) : ''; | |
| }, | |
| color: 'red', | |
| } | |
| } | |
| } | |
| }, | |
| }; | |
| 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_0079_line.inline01.js"></script> | |
| </body> | |
| </html> | |