• 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
    • Combination of Range, Area and Line Charts
  • 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
    • Python Charts
    • JSP Charts
    • Spring MVC Charts
    • ASP.NET MVC Charts

PHP OHLC / Stock Charts & Graphs

Download PHP Chart Samples
  • PHP Chart Samples
  • JavaScript Chart Samples
  • React Chart Samples
  • Angular Chart Samples
  • Vue.js Chart Samples
  • jQuery Chart Samples
  • Python Django Chart Samples
  • ASP.NET Chart Samples
  • JSP Chart Samples
  • Spring MVC Chart Samples
  • Dashboard Samples
  • JavaScript StockChart Samples

OHLC / Stock Charts are used to illustrate movements in the price of a financial instrument over time. Given example shows stock price in PHP OHLC Chart. It also includes source code that you can try running locally.

  • PHP Code
<?php

$dataPoints = array( 
	array("x" => 1483209000000, "y" => array( 104.4, 111.89, 99.11, 109.18)),
	array("x" => 1485887400000, "y" => array( 110.58, 120.92, 95.7, 101.48)),
	array("x" => 1488306600000, "y" => array( 103.79, 110, 95.17, 108.93)),
	array("x" => 1490985000000, "y" => array( 104.74, 147, 102.31, 144.35)),
	array("x" => 1493577000000, "y" => array( 144.99, 168.5, 142.11, 144.56)),
	array("x" => 1496255400000, "y" => array( 145.05, 169.93, 138.58, 162.51)),
	array("x" => 1498847400000, "y" => array( 162.13, 174.56, 152.91, 169.44)),
	array("x" => 1501525800000, "y" => array( 169.95, 191.2, 162.71, 178.77)),
	array("x" => 1504204200000, "y" => array( 180.8, 207.89, 177, 206.81)),
	array("x" => 1506796200000, "y" => array( 209.35, 218.67, 191.23, 200.71)),
	array("x" => 1509474600000, "y" => array( 207.2, 218.67, 200.37, 216.14)),
	array("x" => 1512066600000, "y" => array( 199.31, 200.3, 180.58, 193.5))
)

?>
<!DOCTYPE HTML>
<html>
<head>
<script>
window.onload = function() {


var chart = new CanvasJS.Chart("chartContainer", {
	theme: "light2",
	title: {
		text: "NVIDIA Corporation Stock Price - 2017"
	},
	axisX: {
		valueFormatString: "MMM",
		intervalType: "month",
		interval: 1
	},
	axisY: {
		title: "Stock Price (in USD)",
		prefix: "$"
	},
	data: [{
		type: "ohlc",
		xValueType: "dateTime",
		yValueFormatString: "$#,##0.0",
		xValueFormatString: "MMM",
		dataPoints: <?php echo json_encode($dataPoints, JSON_NUMERIC_CHECK); ?>
	}]
});
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>                              

Chart Customizations

color property can be used change the color of data-points. Some other commonly used customization options are , indexLabel, showInLegend, etc.

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