Chart With Gaps In Data

Developer
Size
2,914 Kb
Views
10,120

How do I make an chart with gaps in data?

Our charts can handle gaps in data in different ways - display real gaps in the graphs, like in this sample, or, if you prefer not to have these gaps, the graph might connect data points. And even more - catrgory axis can simply omit the dates with no data. In this case all the spaces between data points will be equal, no matter if the dates go one by another or not.. What is a chart with gaps in data? How do you make a chart with gaps in data? This script and codes were developed by Otto Garcia on 02 December 2022, Friday.

Chart With Gaps In Data Previews

Chart With Gaps In Data - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Chart With Gaps In Data</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <script src="https://www.amcharts.com/lib/3/amcharts.js"></script>
<script src="https://www.amcharts.com/lib/3/serial.js"></script>
<script src="https://www.amcharts.com/lib/3/themes/light.js"></script>
<script src="https://www.amcharts.com/lib/3/plugins/export/export.min.js"></script>
<link rel="stylesheet" href="https://www.amcharts.com/lib/3/plugins/export/export.css" type="text/css" media="all" />
<div id="chartdiv"></div> <script src='https://code.jquery.com/jquery-1.11.2.min.js'></script> <script src="js/index.js"></script>
</body>
</html>

Chart With Gaps In Data - Script Codes CSS Codes

#chartdiv {	width	: 100%;	height	: 500px;
}

Chart With Gaps In Data - Script Codes JS Codes

var chart = AmCharts.makeChart("chartdiv", { "type": "serial", "theme": "light", "marginRight": 70, "autoMarginOffset": 20, "dataProvider": [{ "year": "1950", "value": -0.307 }, { "year": "1951", "value": -0.168 }, { "year": "1952", "value": -0.073 }, { "year": "1953", "value": -0.027 }, { "year": "1954", "value": -0.251 }, { "year": "1955", "value": -0.281 }, { "year": "1956", "value": -0.348 }, { "year": "1957", "value": -0.074 }, { "year": "1958", "value": -0.011 }, { "year": "1959", "value": -0.074 }, { "year": "1960", "value": -0.124 }, { "year": "1961", "value": -0.024 }, { "year": "1962", "value": -0.022 }, { "year": "1963", "value": 0 }, { "year": "1964", "value": -0.296 }, { "year": "1965", "value": -0.217 }, { "year": "1966", "value": -0.147 }, { "year": "1971", "value": -0.19 }, { "year": "1972", "value": -0.056 }, { "year": "1973", "value": 0.077 }, { "year": "1974", "value": -0.213 }, { "year": "1975", "value": -0.17 }, { "year": "1976", "value": -0.254 }, { "year": "1977", "value": 0.019 }, { "year": "1978", "value": -0.063 }, { "year": "1979", "value": 0.05 }, { "year": "1980", "value": 0.077 }, { "year": "1981", "value": 0.12 }, { "year": "1982", "value": 0.011 }, { "year": "1983", "value": 0.177 }, { "year": "1989", "value": 0.104 }, { "year": "1990", "value": 0.255 }, { "year": "1991", "value": 0.21 }, { "year": "1992", "value": 0.065 }, { "year": "1993", "value": 0.11 }, { "year": "1994", "value": 0.172 }, { "year": "1995", "value": 0.269 }, { "year": "1996", "value": 0.141 }, { "year": "1997", "value": 0.353 }, { "year": "1998", "value": 0.548 }, { "year": "1999", "value": 0.298 }, { "year": "2000", "value": 0.267 }, { "year": "2001", "value": 0.411 }, { "year": "2002", "value": 0.462 }, { "year": "2003", "value": 0.47 }, { "year": "2004", "value": 0.445 }, { "year": "2005", "value": 0.47 }], "balloon": { "cornerRadius": 6 }, "valueAxes": [{ "axisAlpha": 0 }], "graphs": [{ "balloonText": "[[category]]<br><b><span style='font-size:14px;'>[[value]] C</span></b>", "bullet": "round", "bulletSize": 6, "connect": false, "lineColor": "#b6d278", "lineThickness": 2, "negativeLineColor": "#487dac", "valueField": "value" }], "chartCursor": { "categoryBalloonDateFormat": "YYYY", "cursorAlpha": 0.1, "cursorColor": "#000000", "fullWidth": true, "graphBulletSize": 2 }, "chartScrollbar": {}, "dataDateFormat": "YYYY", "categoryField": "year", "categoryAxis": { "minPeriod": "YYYY", "parseDates": true, "minorGridEnabled": true }, "export": { "enabled": true }
});
chart.addListener("dataUpdated", zoomChart);
function zoomChart(){ chart.zoomToDates(new Date(1970, 0), new Date(1995, 0));
}
Chart With Gaps In Data - Script Codes
Chart With Gaps In Data - Script Codes
Home Page Home
Developer Otto Garcia
Username good886
Uploaded December 02, 2022
Rating 3
Size 2,914 Kb
Views 10,120
Do you need developer help for Chart With Gaps In Data?

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!

Otto Garcia (good886) Script Codes
Create amazing blog posts 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!