Jqplot - limit label labels are displayed in just 1 series

using jqPlot, is it possible to limit point labels to only one series? See screenshot below! What I would like to display are simply the values ​​above the "Actual" bar. Medium and Planned should not be displayed!

Thanks!

below

Here is my code

<script type="text/javascript"> $(document).ready(function () { $.jqplot.config.enablePlugins = true; var trendline = [60000, 70000, 110000, 80000]; var planned = [70000, 90000, 120000, 100000,]; var actual = [80000, 80000, 150000, 120000]; var xAxis = ['Jan', 'Feb', 'Mar', 'Apr']; $(function() { $.jqplot('chartDiv', [planned, actual, trendline], BarChart()); }); function BarChart() { var optionsObj = { title: '', axes: { xaxis: { renderer: $.jqplot.CategoryAxisRenderer, ticks: xAxis, }, yaxis: { tickOptions: { showMark: false, formatString: "%'d" }, }, }, legend: { show: true, }, grid: { borderColor: "#dad5d1", background: "#dad5d1", drawGridlines: false, shadow: false }, series: [ {label:'Planned',renderer:$.jqplot.BarRenderer}, {label: 'Actual',renderer:$.jqplot.BarRenderer}, {label: 'Mean', pointLabels: { show: true, }, renderer:$.jqplot.LineRenderer, lineWidth:4, markerOptions:{ color: "#d87d12", size:12, }} ], seriesColors: [ "#ada195", "#4a4541", "#ff9619"], seriesDefaults:{ shadow: false, rendererOptions:{ barPadding: 0, barMargin: 10, barWidth: 25 } }, }; return optionsObj; } }); </script> 
+1
source share
1 answer

This seems like an error in the point label plugin. You can get around it by disabling the values ​​in the Default series (show: false) and then enabling them for the desired series:

  series: [ {label:'Planned',renderer:$.jqplot.BarRenderer}, {label: 'Actual',renderer:$.jqplot.BarRenderer}, {label: 'Mean', pointLabels: { show: true, }, renderer:$.jqplot.LineRenderer, lineWidth:4, markerOptions:{ color: "#d87d12", size:12, }} ], seriesDefaults:{ pointLabels:{show:false}, shadow: false, rendererOptions:{ barPadding: 0, barMargin: 10, barWidth: 25 } }, 
+1
source

Source: https://habr.com/ru/post/1402290/


All Articles