• Demos
    • JavaScript Charts
    • JavaScript StockCharts
  • Download/NPM
    • Download CanvasJS
    • Install via NPM
  • Integrations
    Front End Technology Samples
    • React Charts
    • Angular Charts
    • Vue.js Charts New!
    • jQuery Charts
    • Dashboards
    Server Side Technology Samples
    • PHP Charts
    • Python Charts New!
    • ASP.NET MVC Charts
    • Spring MVC Charts
    • JSP Charts
  • License
  • Blog
  • Docs
    • Chart Documentation
    • StockChart Documentation
  • Support Forum
    • Chart Support
    • StockChart Support
  • My Account
My Account
  • KEY FEATURES
    • Chart with Index / Data Label
    • Chart with Zooming / Panning
    • Chart using JSON Data
    • Chart with Animation
    • Multi Series Chart
    • Chart with Multiple Axes
    • Chart with Crosshair
    • Chart with Scale Breaks
    • Chart with Logarithmic Axis
    • Performance with 50,000 Data Points
    • Responsive Charts
    • Chart with Drilldown
  • LINE CHARTS
    • Line Chart
    • Spline Chart
    • Step Line Chart
  • AREA CHARTS
    • Area Chart
    • Multi Series Area Chart with Date Time Axis
    • Spline Area Chart
    • Step Area Chart
    • Range Area Chart
    • Range Spline Area Chart
    • Stacked Area Chart
    • Stacked Area 100% Chart
  • COLUMN & BAR CHARTS
    • Column Chart
    • Bar Chart
    • Range Column Chart
    • Stacked Column Chart
    • Stacked Column 100% Chart
    • Range Bar Chart
    • Stacked Bar Chart
    • Stacked Bar 100% Chart
    • Waterfall Chart
  • PIE & FUNNEL CHARTS
    • Pie Chart
    • Pie Chart with Index Labels Placed Inside
    • Doughnut Chart
    • Funnel Chart
    • Funnel Chart with Custom Neck
    • Pyramid Chart
  • FINANCIAL CHARTS
    • Candlestick Chart
    • Candlestick Chart from JSON
    • OHLC Chart
  • SCATTER & BUBBLE CHARTS
    • Scatter Chart
    • Scatter Chart with Custom Markers
    • Bubble Chart
  • BOX & WHISKER CHARTS
    • Box and Whisker Chart
    • Box and Whisker Chart with Customization
  • COMBINATION CHARTS
    • Error chart
    • Error Line Chart
    • Pareto Chart
    • Combination of Column, Line and Area Chart
  • DYNAMIC CHARTS
    • Dynamic Line Chart
    • Dynamic Column Chart
    • Dynamic Multi Series Chart
  • DATA BINDING
    • Chart from CSV
    • Chart from XML
    • Chart Data from Database
  • REACT, ANGULAR, VUE.JS, JQUERY
    • React Charts
    • Angular Charts
    • Vue.js Charts
    • jQuery Charts
    • JavaScript Charts
  • SERVER SIDE TECHNOLOGIES
    • Spring MVC Charts
    • ASP.NET MVC Charts
    • PHP Charts
    • Python Charts

JSP Charts & Graphs with Logarithmic Axis

Download JSP Chart Samples
  • JSP Chart Samples
  • JavaScript Chart Samples
  • React Chart Samples
  • Angular Chart Samples
  • Vue.js Chart Samples
  • jQuery Chart Samples
  • PHP Chart Samples
  • Python Django Chart Samples
  • ASP.NET Chart Samples
  • Spring MVC Chart Samples
  • Dashboard Samples
  • JavaScript StockChart Samples
  • JSP Code
<%@ page language="java" contentType="text/html; charset=UTF-8"	pageEncoding="UTF-8"%>
<%@ page import="java.util.*" %>
<%@ page import="com.google.gson.Gson"%>
<%@ page import="com.google.gson.JsonObject"%>

<%
Gson gsonObj = new Gson();
Map<Object,Object> map = null;
List<Map<Object,Object>> list = new ArrayList<Map<Object,Object>>();

map = new HashMap<Object,Object>(); map.put("x", 0); map.put("y", 1.293E-03); list.add(map);
map = new HashMap<Object,Object>(); map.put("x", 10); map.put("y", 3.982E-04); list.add(map);
map = new HashMap<Object,Object>(); map.put("x", 20); map.put("y", 8.269E-05); list.add(map);
map = new HashMap<Object,Object>(); map.put("x", 30); map.put("y", 1.554E-05); list.add(map);
map = new HashMap<Object,Object>(); map.put("x", 40); map.put("y", 3.148E-06); list.add(map);
map = new HashMap<Object,Object>(); map.put("x", 50); map.put("y", 8.280E-07); list.add(map);
map = new HashMap<Object,Object>(); map.put("x", 60); map.put("y", 2.328E-07); list.add(map);
map = new HashMap<Object,Object>(); map.put("x", 70); map.put("y", 5.761E-08); list.add(map);
map = new HashMap<Object,Object>(); map.put("x", 80); map.put("y", 1.296E-08); list.add(map);
map = new HashMap<Object,Object>(); map.put("x", 90); map.put("y", 2.702E-09); list.add(map);
map = new HashMap<Object,Object>(); map.put("x", 100); map.put("y", 4.535E-10); list.add(map);
map = new HashMap<Object,Object>(); map.put("x", 110); map.put("y", 6.809E-11); list.add(map);
map = new HashMap<Object,Object>(); map.put("x", 120); map.put("y", 1.604E-11); list.add(map);
map = new HashMap<Object,Object>(); map.put("x", 130); map.put("y", 6.210E-12); list.add(map);
map = new HashMap<Object,Object>(); map.put("x", 140); map.put("y", 3.143E-12); list.add(map);
map = new HashMap<Object,Object>(); map.put("x", 150); map.put("y", 1.825E-12); list.add(map);

String dataPoints1 = gsonObj.toJson(list);

list = new ArrayList<Map<Object,Object>>();
map = new HashMap<Object,Object>(); map.put("x", 0); map.put("y", 272.1); list.add(map);
map = new HashMap<Object,Object>(); map.put("x", 10); map.put("y", 214.9); list.add(map);
map = new HashMap<Object,Object>(); map.put("x", 20); map.put("y", 206.7); list.add(map);
map = new HashMap<Object,Object>(); map.put("x", 30); map.put("y", 216.5); list.add(map);
map = new HashMap<Object,Object>(); map.put("x", 40); map.put("y", 250.6); list.add(map);
map = new HashMap<Object,Object>(); map.put("x", 50); map.put("y", 258.5); list.add(map);
map = new HashMap<Object,Object>(); map.put("x", 60); map.put("y", 238.1); list.add(map);
map = new HashMap<Object,Object>(); map.put("x", 70); map.put("y", 221.7); list.add(map);
map = new HashMap<Object,Object>(); map.put("x", 80); map.put("y", 210.2); list.add(map);
map = new HashMap<Object,Object>(); map.put("x", 90); map.put("y", 189); list.add(map);
map = new HashMap<Object,Object>(); map.put("x", 100); map.put("y", 182.3); list.add(map);
map = new HashMap<Object,Object>(); map.put("x", 110); map.put("y", 255.4); list.add(map);
map = new HashMap<Object,Object>(); map.put("x", 120); map.put("y", 400.2); list.add(map);
map = new HashMap<Object,Object>(); map.put("x", 130); map.put("y", 534.3); list.add(map);
map = new HashMap<Object,Object>(); map.put("x", 140); map.put("y", 630.4); list.add(map);
map = new HashMap<Object,Object>(); map.put("x", 150); map.put("y", 700.5); list.add(map);

String dataPoints2 = gsonObj.toJson(list);
%>

<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script type="text/javascript">
window.onload = function() { 

	var chart = new CanvasJS.Chart("chartContainer", {
		animationEnabled: true,
		zoomEnabled: true,
		theme: "light2",
		title: {
			text: "Change in Atmospheric Mass Density and Temperature with Altitude"
		},
		axisX: {
			title: "Altitude",
			valueFormatString: "#,##0 km"
		},
		axisY: {
			logarithmic: true, //change it to false
			title: "Atmospheric Mass Density (g/cm3)",
			titleFontColor: "#6D78AD",
			lineColor: "#6D78AD",
			gridThickness: 0,
			lineThickness: 1,
			valueFormatString: "0.0#E+0"
		},
		axisY2: {
			title: "Temperature (K)",
			titleFontColor: "#51CDA0",
			logarithmic: false, //change it to true
			lineColor: "#51CDA0",
			gridThickness: 0,
			lineThickness: 1
		},
		toolTip: {
			shared: true
		},
		legend: {
			verticalAlign: "top",
			dockInsidePlotArea: true
		},
		data: [{
			type: "line",
			yValueFormatString: "0.0##E+0 g/cm3",
			xValueFormatString: "#,##0 km",
			showInLegend: true,
			name: "Atmospheric Mass Density",
			legendText: "{name} (in Log Scale)",
			dataPoints: <%out.print(dataPoints1);%>
		},
		{
			type: "line",
			yValueFormatString: "###0 K",
			xValueFormatString: "#,##0 km",
			axisYType: "secondary",
			showInLegend: true,
			name: "Temperature",
			legendText: "{name} (in Linear Scale)",
			dataPoints: <%out.print(dataPoints2);%>
		}]
	});
	chart.render();

}
</script>
</head>
<body>
<div id="chartContainer" style="height: 370px; width: 100%;"></div>
<script src="https://cdn.canvasjs.com/canvasjs.min.js"></script>
</body>
</html>                              

Quick Links

  • Chart Docs
  • StockChart Docs
  • About Us
  • FAQs

Server Side Technologies

  • ASP.NET MVC Charts
  • PHP Charts
  • JSP Charts
  • Spring MVC Charts

Front Side Technologies

  • JavaScript Charts
  • jQuery Charts
  • React Charts
  • Angular Charts
  • JavaScript StockCharts

Contact

  • Fenopix, Inc.
  • 2093 Philadelphia Pike,
  • #5678, Claymont,
  • Delaware 19703
  • United States Of America

©2025 Fenopix Privacy Policy Cookies Policy Careers