Download web/AnyChart/box/chart_0037_box.html from chartact-benchmark/ChartAct: direct link, hf CLI and curl.
- Browser
- Download file 5.05 kB
-
https://huggingface.co/datasets/chartact-benchmark/ChartAct/resolve/main/web/AnyChart/box/chart_0037_box.html
- Command line
-
hf download hf://datasets/chartact-benchmark/ChartAct/web/AnyChart/box/chart_0037_box.html
-
curl -L -o chart_0037_box.html https://huggingface.co/datasets/chartact-benchmark/ChartAct/resolve/main/web/AnyChart/box/chart_0037_box.html
5.05 kB
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta content="IE=edge" http-equiv="X-UA-Compatible"> | |
| <meta content="width=device-width, initial-scale=1" name="viewport"> | |
| <title>BCT Box Chart 01</title> | |
| <link href="https://playground.anychart.com/3LXN62FD/iframe" rel="canonical"> | |
| <meta content="Box Chart,Box and Whisker Plot,Statistical Data,Dot Chart,Marker Chart,Multiple Axes" name="keywords"> | |
| <meta content="AnyChart - JavaScript Charts designed to be embedded and integrated" name="description"> | |
| <!--[if lt IE 9]> | |
| <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script> | |
| <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> | |
| <![endif]--> | |
| <link href="_deps/cdn.anychart.com/releases/8.3.0/css/anychart-ui.min.css" rel="stylesheet" type="text/css"> | |
| <style>html, body, #container { | |
| width: 100%; | |
| height: 100%; | |
| margin: 0; | |
| padding: 0; | |
| }</style> | |
| </head> | |
| <body> | |
| <div id="container"></div> | |
| <script src="_deps/cdn.anychart.com/releases/8.3.0/js/anychart-base.min.js"></script> | |
| <script src="_deps/cdn.anychart.com/releases/8.3.0/js/anychart-exports.min.js"></script> | |
| <script src="_deps/cdn.anychart.com/releases/8.3.0/js/anychart-ui.min.js"></script> | |
| <script type="text/javascript"> | |
| anychart.onDocumentReady(function () { | |
| // create data | |
| var data = [ | |
| { x: "Jan", low: 1000, q1: 1050, median: 1200, q3: 1800, high: 2000, customOutliers: [800, 2500, 3200] }, | |
| { x: "Feb", low: 2500, q1: 3000, median: 3800, q3: 3900, high: 4000 }, | |
| { x: "Mar", low: 2000, q1: 2300, median: 2500, q3: 2900, high: 3000 }, | |
| { x: "Apr", low: 4000, q1: 5000, median: 6500, q3: 6500, high: 7000, customOutliers: [8930] }, | |
| { x: "May", low: 8000, q1: 8400, median: 8500, q3: 8800, high: 9000, customOutliers: [6950, 3000] } | |
| ]; | |
| var data2 = [ | |
| { x: "Jan", low: 1000, q1: 1050, median: 1200, q3: 1800, high: 2000, customOutliers: [5000, 2500] }, | |
| { x: "Feb", low: 2500, q1: 3000, median: 3800, q3: 3900, high: 4000, customOutliers: [4300, 2300] }, | |
| { x: "Mar", low: 2000, q1: 2300, median: 2500, q3: 2900, high: 3000 }, | |
| { x: "Apr", low: 4000, q1: 5000, median: 6500, q3: 6500, high: 7000, customOutliers: [8930] }, | |
| { x: "May", low: 8000, q1: 8400, median: 8500, q3: 8800, high: 9000, customOutliers: [6950, 3000] } | |
| ] | |
| //prepare data | |
| var processedData = preprocessingData(data, 1); | |
| var processedData2 = preprocessingData(data2, 2); | |
| // create a chart | |
| var chart = anychart.box(); | |
| //enable yGrid | |
| chart.yGrid(true); | |
| // create a box series and set the data | |
| var boxSeries = chart.box(data); | |
| boxSeries.name('Box plots'); | |
| var boxSeries2 = chart.box(data2); | |
| boxSeries2.name('Box plots2'); | |
| //a trick to provide multiseries outlier | |
| chart.barsPadding(1); | |
| chart.barGroupsPadding(3); | |
| var customXScale = anychart.scales.linear(); | |
| customXScale.minimum(0); | |
| customXScale.maximum(data.length * 3); | |
| customXScale.ticks().interval(1); | |
| var customXAxis = chart.xAxis(1); | |
| customXAxis.scale(customXScale); | |
| chart.xAxis(1).enabled(false); | |
| //create separate outliers series | |
| var outliersSet = anychart.data.set(processedData.outliersData); | |
| var outliersSet2 = anychart.data.set(processedData2.outliersData); | |
| createOutliers(processedData, outliersSet, customXScale); | |
| createOutliers(processedData2, outliersSet2, customXScale); | |
| //set chart title | |
| chart.title('Ungrouped box chart'); | |
| //adjust chart legend | |
| chart.legend(true); | |
| //render chart | |
| chart.container("container").draw(); | |
| //helper function for processing data | |
| function preprocessingData(data, index) { | |
| var processedData = { | |
| outliersData: [], | |
| outliersSeriesCount: 0 | |
| }; | |
| var row; | |
| var currentOutliers; | |
| for (var i = 0; i < data.length; i++) { | |
| row = data[i]; | |
| currentOutliers = []; | |
| // currentOutliers.push(row.x); | |
| currentOutliers.push(index + i*3); | |
| if (row.customOutliers) { | |
| for (var j = 0; j < row.customOutliers.length; j++) { | |
| currentOutliers.push(row.customOutliers[j]); | |
| } | |
| if (currentOutliers.length > processedData.outliersSeriesCount) | |
| processedData.outliersSeriesCount = currentOutliers.length; | |
| } | |
| processedData.outliersData.push(currentOutliers); | |
| } | |
| processedData.outliersSeriesCount -= 1; | |
| return processedData; | |
| } | |
| //helper function to create an outlier series | |
| function createOutliers(processedData, outliersSet, customXScale) { | |
| for (var i = 1; i <= processedData.outliersSeriesCount; i++) { | |
| var mapping = outliersSet.mapAs({ 'x': 0, 'value': i }); | |
| var outlierSeries = chart.marker(mapping); | |
| outlierSeries.name('Outliers'); | |
| outlierSeries.normal() | |
| .size(5) | |
| .type("circle") | |
| .fill("green", 0.3) | |
| .stroke("green", 1); | |
| outlierSeries.hovered().size(7); | |
| outlierSeries.selected().size(7); | |
| outlierSeries.legendItem().enabled(false); | |
| outlierSeries.xScale(customXScale); | |
| } | |
| } | |
| }); | |
| </script> | |
| </body> | |
| </html> |