Download web/AnyChart/bar/chart_0059_bar.html from chartact-benchmark/ChartAct: direct link, hf CLI and curl.
- Browser
- Download file 4.3 kB
-
https://huggingface.co/datasets/chartact-benchmark/ChartAct/resolve/main/web/AnyChart/bar/chart_0059_bar.html
- Command line
-
hf download hf://datasets/chartact-benchmark/ChartAct/web/AnyChart/bar/chart_0059_bar.html
-
curl -L -o chart_0059_bar.html https://huggingface.co/datasets/chartact-benchmark/ChartAct/resolve/main/web/AnyChart/bar/chart_0059_bar.html
4.3 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>Stacked Bar Chart with Negative Values</title> | |
| <link href="https://playground.anychart.com/ZJt9gvAs/iframe" rel="canonical"> | |
| <meta content="Animation,Bar Chart,Bar Graph,Column Chart,Multi-Series Chart,Multiple Axes,Stacked Chart,Tooltip,Vertical Chart" 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/v8/css/anychart-ui.min.css" rel="stylesheet" type="text/css"> | |
| <link href="_deps/cdn.anychart.com/releases/v8/fonts/css/anychart-font.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/v8/js/anychart-base.min.js"></script> | |
| <script src="_deps/cdn.anychart.com/releases/v8/js/anychart-ui.min.js"></script> | |
| <script src="_deps/cdn.anychart.com/releases/v8/js/anychart-exports.min.js"></script> | |
| <script src="_deps/cdn.anychart.com/releases/v8/themes/light_blue.js"></script> | |
| <script type="text/javascript"> | |
| anychart.onDocumentReady(function () { | |
| // create data set | |
| var dataSet = anychart.data.set(getData()); | |
| // map data for the first series, take x from the zero column and value from the first column of data set | |
| var firstSeriesData = dataSet.mapAs({ x: 0, value: 1 }); | |
| // map data for the second series, take x from the zero column and value from the second column of data set | |
| var secondSeriesData = dataSet.mapAs({ x: 0, value: 2 }); | |
| // create bar chart | |
| var chart = anychart.bar(); | |
| // turn on chart animation | |
| chart.animation(true); | |
| // set padding | |
| chart.padding([10, 20, 5, 20]); | |
| // force chart to stack values by Y scale. | |
| chart.yScale().stackMode('value'); | |
| // format y axis labels so they are always positive | |
| chart | |
| .yAxis() | |
| .labels() | |
| .format(function () { | |
| return Math.abs(this.value).toLocaleString(); | |
| }); | |
| // set title for Y-axis | |
| chart.yAxis(0).title('?????????? ??????????'); | |
| // allow labels to overlap | |
| chart.xAxis(0).overlapMode('allow-overlap'); | |
| // turn on extra axis for the symmetry | |
| chart | |
| .xAxis(1) | |
| .enabled(true) | |
| .orientation('right') | |
| .overlapMode('allow-overlap'); | |
| // set chart title text | |
| //chart.title('Cosmetic Sales by Gender'); | |
| chart.interactivity().hoverMode('by-x'); | |
| chart | |
| .tooltip() | |
| .title(false) | |
| .separator(false) | |
| .displayMode('separated') | |
| .positionMode('point') | |
| .useHtml(true) | |
| .fontSize(12) | |
| .offsetX(5) | |
| .offsetY(0) | |
| .format(function () { | |
| return ( | |
| Math.abs(this.value).toLocaleString() +'<span style="color: #D9D9D9">%</span>' | |
| ); | |
| }); | |
| // temp variable to store series instance | |
| var series; | |
| // create first series with mapped data | |
| series = chart.bar(firstSeriesData); | |
| series.name('???').color('DarkTurquoise'); | |
| series.tooltip().position('right').anchor('left-center'); | |
| // create second series with mapped data | |
| series = chart.bar(secondSeriesData); | |
| series.name('??????').color('MediumSlateBlue'); | |
| series.tooltip().position('left').anchor('right-center'); | |
| // turn on legend | |
| chart | |
| .legend() | |
| .enabled(true) | |
| .inverted(true) | |
| .fontSize(13) | |
| .padding([0, 0, 20, 0]); | |
| // set container id for the chart | |
| chart.container('container'); | |
| // initiate chart drawing | |
| chart.draw(); | |
| }); | |
| function getData() { | |
| return [ | |
| ['????????????? ????????????? ?????', 51, -100], | |
| ['????????????', 16, -89], | |
| ['????????? ???????????', 60, -78], | |
| ['???????? ? ????????', 31, -53], | |
| ['????????????? ???????', 27, -53], | |
| ['?????????? ??????', 16, -51], | |
| ['?????? ?????????????', 23, -50], | |
| ['???????? ????????', 100, -40], | |
| ['????????????? ???', 4, -40], | |
| ['???????????? ??????', 54, -38], | |
| ['?????????? ????????? ????', 100, -27], | |
| ['??????????? ????????', 34, -26], | |
| ]; | |
| }</script> | |
| </body> | |
| </html> |