| <!doctype html>
|
| <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 Column and Line Chart</title>
|
| <link href="https://playground.anychart.com/iqQIe9RS/iframe" rel="canonical">
|
| <meta content="Animation,Bar Chart,Column Chart,Multi-Series Chart,Multiple Axes,Stacked Chart" name="keywords">
|
| <meta content="AnyChart - JavaScript Charts designed to be embedded and integrated" name="description">
|
| |
| |
| |
|
|
| <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 type="text/javascript">anychart.onDocumentReady(function () {
|
|
|
| var dataSet = anychart.data.set([
|
| ['Jan-2022', 5250, 5250, 0],
|
| ['Feb-2022', 7125, 1875, 0],
|
| ['Mar-2022', 25993, 5850, 13018],
|
| ['Apr-2022', 30755.5, 1500, 3262.5],
|
| ['May-2022', 35818.5, 0, 5063],
|
| ['Jun-2022', 49693.5, 3750, 10125],
|
| ['Jul-2022', 51568.5, 1875, 0],
|
| ['Aug-2022', 63880, 0, 12311.5],
|
| ['Sep-2022', 73286, 3750, 5656],
|
| ['Oct-2022', 81911, 3975, 4650],
|
| ['Nov-2022', 93161, 3750, 7500],
|
| ['Dec-2022', 98828, 1500, 4167]
|
| ]);
|
|
|
|
|
| var firstSeriesData = dataSet.mapAs({ x: 0, value: 1 });
|
|
|
|
|
| var secondSeriesData = dataSet.mapAs({ x: 0, value: 2 });
|
|
|
|
|
| var thirdSeriesData = dataSet.mapAs({ x: 0, value: 3 });
|
|
|
|
|
| var fourthSeriesData = dataSet.mapAs({ x: 0, value: 4 });
|
|
|
|
|
| var chart = anychart.column();
|
|
|
|
|
| chart.animation(true);
|
|
|
|
|
| chart.title(
|
| 'Combination of Stacked Column and Line Chart (Dual Y-Axis)'
|
| );
|
|
|
|
|
| chart.yScale().stackMode('value');
|
|
|
|
|
|
|
| var scale = anychart.scales.linear();
|
| scale.minimum(0).maximum(100000).ticks({ interval: 20 });
|
|
|
|
|
|
|
| var extraYAxis = chart.yAxis(1);
|
| extraYAxis.orientation('right').scale(scale);
|
| extraYAxis.labels().padding(0, 0, 0, 5);
|
|
|
|
|
|
|
|
|
|
|
| chart.column(secondSeriesData).name("Experience Cost Savings").color("Green");
|
|
|
| chart.crosshair(true);
|
|
|
|
|
| var lineSeries = chart.line(firstSeriesData).name("Incremental Cost Savings").color("#f1c232");
|
| lineSeries.yScale(scale).markers(true);
|
|
|
|
|
| chart.column(thirdSeriesData).name("Fulfilment Cost Savings").color("#0080ff");
|
|
|
|
|
|
|
|
|
|
|
| chart.container('container');
|
|
|
|
|
| chart.draw();
|
|
|
|
|
| var legend = chart.legend();
|
| legend.enabled(true);
|
| legend.position('center');
|
| legend.itemsLayout('horizontal');
|
|
|
|
|
|
|
|
|
| });</script>
|
| </body>
|
| </html> |