Home › Forums › Feature Requests & Feedback › Responsive Font Size – IndexLabelFontSize › Reply To: Responsive Font Size – IndexLabelFontSize
Ryan,
Font size remains the same even after resize as you are setting indexLabelFontSize to 36. You can change indexLabelFontSize on resize of window and relate it to chart-container width and can have minimum and maximum limits on the same.
Kindly take a look at the code-snippet below,
$(window).resize(function() { for(var i = 0; i < chart.options.data.length; i++){ chart.options.data[i].indexLabelFontSize = Math.min(36, Math.max( 12, $("#chartContainer").width() / 10)); } chart.render(); });
Please take a look at this updated jsfiddle.
— Vishwas R Team CanvasJS