Google Charts API - Dual Y-axis Line Chart v2

Developer
Size
2,664 Kb
Views
32,384

How do I make an google charts api - dual y-axis line chart v2?

What is a google charts api - dual y-axis line chart v2? How do you make a google charts api - dual y-axis line chart v2? This script and codes were developed by NM on 22 October 2022, Saturday.

Google Charts API - Dual Y-axis Line Chart v2 Previews

Google Charts API - Dual Y-axis Line Chart v2 - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Google Charts API - Dual Y-axis Line Chart v2</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <div id="chart_div"></div>
<div id="my_div"></div> <script src='https://www.gstatic.com/charts/loader.js'></script> <script src="js/index.js"></script>
</body>
</html>

Google Charts API - Dual Y-axis Line Chart v2 - Script Codes CSS Codes

body { margin: 0; padding: 0;
}
img.ri { position: relative; display: block; width: 100%; height: auto;
}

Google Charts API - Dual Y-axis Line Chart v2 - Script Codes JS Codes

 google.charts.load('current', {'packages':['corechart']}); google.charts.setOnLoadCallback(drawChart); function drawChart() { var chartDiv = document.getElementById('chart_div'); var data = new google.visualization.DataTable(); data.addColumn('date', 'Year'); data.addColumn('number', "Workers per dependent"); data.addColumn('number', "Income per person"); data.addRows([ [new Date(1950, 0, 1), 1.1, 900.00], [new Date(1975, 0, 1), 1.0, 800.00], [new Date(2000, 0, 1), 1.2, 500.00], [new Date(2025, 0, 1), 1.1, 700.00], [new Date(2050, 0, 1), 1.0, 600.00], [new Date(2075, 0, 1), 1.2, 500.00], [new Date(2100, 0, 1), 1.1, 900.00], ]); var classicOptions = { title: 'Kenya: potential for demographic dividend', titleTextStyle: { color: 'red', fontSize: 24, bold: true, italic: false }, width: '100%', height: 640, curveType: 'function', fontSize: 14, fontName: 'Arial', backgroundColor: '#ffffff', legend: { position: 'top', alignment: 'start', textStyle: { color: 'red' } }, lineWidth: 2, colors: ['red', 'red'], chartArea:{ left: 100, top: 100, right: 100, bottom: 100, width: '100%', height: '100%' }, // Gives each series an axis that matches the vAxes number below. series: { 0: { targetAxisIndex: 0, lineDashStyle: [1, 2] }, 1: { targetAxisIndex: 1 } }, vAxes: { 0: { title: 'Workers per dependent', titleTextStyle: { color: 'red', fontSize: 16, bold: true, italic: false, }, textStyle: { color: 'red' }, baseline: 0, baselineColor: 'red', gridlines: { color: 'transparent' }, textPosition: 'out', format: 'decimal', viewWindowMode: 'pretty', viewWindow: { max: 3, min: 0 } }, 1: { title: 'Income per person', titleTextStyle: { color: 'red', fontSize: 16, bold: true, italic: false, }, textStyle: { color: 'red' }, baseline: 0, baselineColor: 'red', gridlines: { color: 'transparent', }, textPosition: 'out', //format: 'currency', format: '€', viewWindowMode: 'pretty', viewWindow: { max: 1000, min:0 } } }, hAxis: { title: 'Year', titleTextStyle: { color: 'red', fontSize: 16, fontSize: 15, bold: true, italic: false }, textStyle: { color: 'red' }, baselineColor: 'red', gridlines: { color: 'lightred', }, textPosition: 'out', //slantedText: true, //slantedTextAngle: 90 } }; function drawClassicChart() { var classicChart = new google.visualization.LineChart(chartDiv); var my_div = document.getElementById('my_div'); google.visualization.events.addListener(classicChart, 'ready', function () { my_div.innerHTML = '<img src="' + classicChart.getImageURI() + '" class="ri">'; }); classicChart.draw(data, classicOptions); } drawClassicChart(); }
Google Charts API - Dual Y-axis Line Chart v2 - Script Codes
Google Charts API - Dual Y-axis Line Chart v2 - Script Codes
Home Page Home
Developer NM
Username tokant
Uploaded October 22, 2022
Rating 3
Size 2,664 Kb
Views 32,384
Do you need developer help for Google Charts API - Dual Y-axis Line Chart v2?

Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!

NM (tokant) Script Codes
Create amazing marketing copy with AI!

Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!