ChartAct / web /AnyChart /bar /chart_0060_bar.html
wumumu's picture
Add files using upload-large-folder tool
7b52e07 verified
Raw History Blame Contribute Delete
5.3 kB
<!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>Sample chart</title>
<link href="https://playground.anychart.com/efGBeQWk/iframe" rel="canonical">
<meta content="Bar Chart,Column Chart,Error Chart,Jump Line Chart,Dot Chart,Marker Chart,Statistical Data,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: 95%;
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">var chart;
anychart.onDocumentReady(function () {
chart=anychart.column();
draw(chart);
});
function draw(chart, type){
rawData =
[
{x: "AFS-HTM securities", val: 4639, valPos: 4764, valBase: 4761, valNeg: 4757, perChangePos: 0.08, perChangeBase: 2.63, perChangeNeg: -0.08, valChangePos: 3.496 , valChangeBase: 122, valChangeNeg: 3.496 , perNegAbs:2.55, perPosAbs:2.71},
{x: "Retail & Wholesale Short Term Loans", val: 8066, valPos: 8495, valBase: 8479, valNeg: 8464, perChangePos: 0.19, perChangeBase: 5.12, perChangeNeg: -0.19, valChangePos: 15.607, valChangeBase: 413, valChangeNeg: 15.599, perNegAbs:4.93, perPosAbs:5.31},
{x: "Mortgages (Managed Rate)", val: 1850, valPos: 1941, valBase: 1939, valNeg: 1937, perChangePos: 0.12, perChangeBase: 4.81, perChangeNeg: -0.12, valChangePos: 2 , valChangeBase: 89, valChangeNeg: 2 , perNegAbs:4.69, perPosAbs:4.93},
{x: "Managed Rate IBCAs", val: 4544, valPos: 4582, valBase: 4578, valNeg: 4574, perChangePos: 0.09, perChangeBase: 0.75, perChangeNeg: -0.08, valChangePos: 4 , valChangeBase: 34.08, valChangeNeg: 4 , perNegAbs:0.67, perPosAbs:0.84},
{x: "Term Deposits", val: 2025, valPos: 2060, valBase: 2058, valNeg: 2056, perChangePos: 0.09, perChangeBase: 1.63, perChangeNeg: -0.09, valChangePos: 2 , valChangeBase: 33, valChangeNeg: 2 , perNegAbs:1.54, perPosAbs:1.72}
];
dataSet = anychart.data.set(rawData)
column = chart.column(dataSet.mapAs({x: "x", value: "val"})).color('DarkGray');
column.labels().enabled(true)
.anchor('bottom')
.position('center-bottom')
.fontColor('white');
column.name('Balance');
jump = chart.jumpLine(dataSet.mapAs({x: "x", value: "perChangeBase"}))
.color('orange')
.pointWidth('100%')
jump.name('Base Case NII');
jump.labels().enabled(true)
.anchor('center')
.position('center')
.fontColor('white');
jump.labels().background().enabled(true);
jump.labels().background().fill('orange');
positiveMarker = chart.marker(dataSet.mapAs({x: "x", value: "perPosAbs"})).color('Green');
positiveMarker.color('green');
positiveMarker.name('+25 bp Parallel Sensitivity');
positiveMarker.labels().enabled(true)
.anchor('top')
.position('center-top')
.offsetY(20)
.fontColor('white');
positiveMarker.labels().background()
.enabled(true)
.fill('green');
negativeMarker = chart.marker(dataSet.mapAs({x: "x", value: "perNegAbs"})).color('Orange');
negativeMarker.color('red');
negativeMarker.name('-25 bp bp Parallel Sensitivity');
negativeMarker.labels().enabled(true)
.anchor('bottom')
.position('center-bottom')
.offsetY(20)
.fontColor('white');
negativeMarker.labels().background()
.enabled(true)
.fill('red');
percentScale = anychart.scales.linear().minimum(-5).maximum(10);
jump.yScale(percentScale);
positiveMarker.yScale(percentScale);
negativeMarker.yScale(percentScale);
chart.yAxis(1).scale(percentScale).orientation('right');
column.labels().format(function(e){ return (e.value/1000).toFixed(2) + 'bn'});
baseLabelFormat = "{%perChangeBase}% \r\n {%valChangeBase}"
jump.labels().format(baseLabelFormat);
posLabelFormat = "{%perChangePos}% \r\n {%valChangePos}"
positiveMarker.labels().format(posLabelFormat);
negLabelFormat = "{%perChangeNeg}% \r\n ({%valChangeNeg})"
negativeMarker.labels().format(negLabelFormat);
chart.legend().enabled(true).position('bottom').padding(20);
chart.xAxis().labels().width("120px");
chart.labels().width('70px');
chart.xAxis().labels().hAlign("center");
chart.yAxis().labels().format("{%value}{scale:(1000)|(bn)}");
chart.container("container");
chart.draw();
}</script>
</body>
</html>