• 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 with Formatted Axes Labels
    • Dashed Line Chart
    • Multi Series Line Chart
    • Spline Chart
    • Multi Series Spline Chart
    • Step Line Chart
    • Multi Series Step Line Chart
  • BAR CHARTS
    • Bar Chart with Category Axis
    • Multi Series Bar Chart
    • Stacked Bar Chart
    • Stacked Bar 100% Chart
    • Stacked Bar 100% Chart with Indexlabel
  • COLUMN CHARTS
    • Column Chart with Category Axis
    • Multi Series Column Chart
    • Stacked Column Chart
    • Stacked Column 100% Chart
    • Stacked Column 100% Chart with Indexlabel
    • Waterfall Chart
    • Waterfall Chart with Indexlabel
  • AREA CHARTS
    • Area Chart with Date-Time Axis
    • Multi Series Area Chart
    • Spline Area Chart
    • Multi Series Spline Area Chart
    • Step Area Chart
    • Stacked Area Chart
    • Stacked Area 100% Chart
  • RANGE CHARTS
    • Range Column Chart
    • Multi Series Range Column Chart
    • Range Bar Chart
    • Multi Series Range Bar Chart
    • Range Area Chart
    • Multi Series Range Area Chart
    • Range Spline Area Chart
    • Multi Series Range Spline Area Chart
  • PIE & DOUGHNUT CHARTS
    • Pie Chart with Indexlabels
    • Pie Chart with Index Labels Placed Inside
    • Doughnut Chart
    • Doughnut Chart in Dark Theme
  • FUNNEL & PYRAMID CHARTS
    • Funnel Chart
    • Funnel Chart with Custom Neck
    • Pyramid Chart
  • FINANCIAL CHARTS
    • Candlestick Chart
    • Candlestick Chart from JSON
    • OHLC Chart
    • OHLC with Trendline
    • Box and Whisker Chart
    • Box and Whisker Chart with Customization
  • BUBBLE & SCATTER CHARTS
    • Scatter Chart
    • Scatter Chart with Custom Markers
    • Bubble Chart
  • 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
  • STOCKCHARTS
    • StockChart with Numeric Axis
    • StockChart with Date-Time Axis
    • StockChart with SplineArea & Range Selector
  • ANGULAR, VUE.JS, JAVASCRIPT, JQUERY
    • Angular Charts
    • Vue.js Charts
    • jQuery Charts
    • JavaScript Charts
  • SERVER SIDE TECHNOLOGIES
    • ASP.NET MVC Charts
    • PHP Charts
    • Python Charts
    • JSP Charts
    • Spring MVC Charts

React Dashed Line Charts & Graphs

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

React Dashed Line Charts are plotted by connecting datapoints with a dashed line instead of solid line.

  • React Code
/* App.js */
import React, { Component } from 'react';
import CanvasJSReact from '@canvasjs/react-charts';
//var CanvasJSReact = require('@canvasjs/react-charts');
 
var CanvasJS = CanvasJSReact.CanvasJS;
var CanvasJSChart = CanvasJSReact.CanvasJSChart;
 
class App extends Component {
	render() {
		const options = {
			animationEnabled: true,
			theme: "light2",
			title:{
				text: "Site Traffic"
			},
			axisX:{
				valueFormatString: "DD MMM",
				crosshair: {
					enabled: true,
					snapToDataPoint: true
				}
			},
			axisY: {
				title: "Number of Visits",
				crosshair: {
					enabled: true
				}
			},
			toolTip:{
				shared:true
			},  
			legend:{
				cursor: "pointer",
				verticalAlign: "top",
				horizontalAlign: "right",
				dockInsidePlotArea: true,
				itemclick: function(e) {
					if (typeof(e.dataSeries.visible) === "undefined" || e.dataSeries.visible) {
						e.dataSeries.visible = false;
					} else{
						e.dataSeries.visible = true;
					}
					e.chart.render();
				}
			},
			data: [{
				type: "line",
				showInLegend: true,
				name: "Total Visit",
				lineDashType: "dash",
				markerType: "square",
				xValueFormatString: "DD MMM, YYYY",
				dataPoints: [
					{ x: new Date(2022, 0, 3), y: 650 },
					{ x: new Date(2022, 0, 4), y: 700 },
					{ x: new Date(2022, 0, 5), y: 710 },
					{ x: new Date(2022, 0, 6), y: 658 },
					{ x: new Date(2022, 0, 7), y: 734 },
					{ x: new Date(2022, 0, 8), y: 963 },
					{ x: new Date(2022, 0, 9), y: 847 },
					{ x: new Date(2022, 0, 10), y: 853 },
					{ x: new Date(2022, 0, 11), y: 869 },
					{ x: new Date(2022, 0, 12), y: 943 },
					{ x: new Date(2022, 0, 13), y: 970 },
					{ x: new Date(2022, 0, 14), y: 869 },
					{ x: new Date(2022, 0, 15), y: 890 },
					{ x: new Date(2022, 0, 16), y: 930 }
				]
			}, {
				type: "line",
				showInLegend: true,
				name: "Unique Visit",
				lineDashType: "dot",
				dataPoints: [
					{ x: new Date(2022, 0, 3), y: 510 },
					{ x: new Date(2022, 0, 4), y: 560 },
					{ x: new Date(2022, 0, 5), y: 540 },
					{ x: new Date(2022, 0, 6), y: 558 },
					{ x: new Date(2022, 0, 7), y: 544 },
					{ x: new Date(2022, 0, 8), y: 693 },
					{ x: new Date(2022, 0, 9), y: 657 },
					{ x: new Date(2022, 0, 10), y: 663 },
					{ x: new Date(2022, 0, 11), y: 639 },
					{ x: new Date(2022, 0, 12), y: 673 },
					{ x: new Date(2022, 0, 13), y: 660 },
					{ x: new Date(2022, 0, 14), y: 562 },
					{ x: new Date(2022, 0, 15), y: 643 },
					{ x: new Date(2022, 0, 16), y: 570 }
				]
			}]
		}	
		return (
		<div>
			<CanvasJSChart options = {options}
				/* onRef={ref => this.chart = ref} */
			/>
			{/*You can get reference to the chart instance as shown above using onRef. This allows you to access all chart properties and methods*/}
		</div>
		);
	}
}
export default App;                              

Chart Customizations

In the above example, use the lineDashType property to create dotted or dashed lines, either at series or for specific datapoints. You can adjust line-thickness with the lineThickness property.

Note   For step by step instructions, follow our React Integration Tutorial

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