Your search did not match any results.
Bar Charts

Customize Points and Labels

Documentation

This demo shows how you can customize individual points and labels in the Chart.

Backend API
Copy to CodePen
Apply
Reset
$(() => { const highAverage = 77; const lowAverage = 58; $('#chart').dxChart({ dataSource, customizePoint() { if (this.value > highAverage) { return { color: '#ff7c7c', hoverStyle: { color: '#ff7c7c' } }; } if (this.value < lowAverage) { return { color: '#8c8cff', hoverStyle: { color: '#8c8cff' } }; } return null; }, customizeLabel() { if (this.value > highAverage) { return { visible: true, backgroundColor: '#ff7c7c', customizeText() { return `${this.valueText}&#176F`; }, }; } return null; }, export: { enabled: true, }, valueAxis: { visualRange: { startValue: 40, }, maxValueMargin: 0.01, label: { customizeText() { return `${this.valueText}&#176F`; }, }, constantLines: [{ label: { text: 'Low Average', }, width: 2, value: lowAverage, color: '#8c8cff', dashStyle: 'dash', }, { label: { text: 'High Average', }, width: 2, value: highAverage, color: '#ff7c7c', dashStyle: 'dash', }], }, series: [{ argumentField: 'day', valueField: 'temperature', type: 'bar', color: '#e7d19a', }], title: { text: 'Daily Temperature in May', }, legend: { visible: false, }, }); });
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>DevExtreme Demo</title> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" /> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script> <script>window.jQuery || document.write(decodeURIComponent('%3Cscript src="js/jquery.min.js"%3E%3C/script%3E'))</script> <link rel="stylesheet" type="text/css" href="https://cdn3.devexpress.com/jslib/21.2.3/css/dx.common.css" /> <link rel="stylesheet" type="text/css" href="https://cdn3.devexpress.com/jslib/21.2.3/css/dx.light.css" /> <script src="https://cdn3.devexpress.com/jslib/21.2.3/js/dx.all.js"></script> <script src="data.js"></script> <link rel="stylesheet" type="text/css" href="styles.css" /> <script src="index.js"></script> </head> <body class="dx-viewport"> <div class="demo-container"> <div id="chart"></div> </div> </body> </html>
#chart { height: 440px; }
const dataSource = [{ day: '1', temperature: 57, }, { day: '2', temperature: 58, }, { day: '3', temperature: 57, }, { day: '4', temperature: 59, }, { day: '5', temperature: 63, }, { day: '6', temperature: 63, }, { day: '7', temperature: 63, }, { day: '8', temperature: 64, }, { day: '9', temperature: 64, }, { day: '10', temperature: 64, }, { day: '11', temperature: 69, }, { day: '12', temperature: 72, }, { day: '13', temperature: 75, }, { day: '14', temperature: 78, }, { day: '15', temperature: 76, }, { day: '16', temperature: 70, }, { day: '17', temperature: 65, }, { day: '18', temperature: 65, }, { day: '19', temperature: 68, }, { day: '20', temperature: 70, }, { day: '21', temperature: 73, }, { day: '22', temperature: 73, }, { day: '23', temperature: 75, }, { day: '24', temperature: 78, }, { day: '25', temperature: 76, }, { day: '26', temperature: 76, }, { day: '27', temperature: 80, }, { day: '28', temperature: 76, }, { day: '29', temperature: 75, }, { day: '30', temperature: 75, }, { day: '31', temperature: 74, }];