highcharts Set Position of dataLabels not work - javascript

I want to show a long pie chart (vertical) not the default (Horizontal)
so I set dataLabels of every data , to move the position to label
but seem like a bug or something , it didn't work
or maybe have another way to do this?
I am very need to solve this issue
very thankful
here is my code:
http://jsfiddle.net/arhspt8011/Jgrdz/1
data: [
{
name:'Label1',
y:50,
dataLabels:
{
ebabled:false,
y:-200
}
},
{
name:'Label2',
y:50,
dataLabels:
{
ebabled:true,
y:-200
}
},
{
name:'Label3',
y:50,
dataLabels:
{
ebabled:true,
y:200
}
}
]
the y of dataLabels didn't work OTZ

You can increase width of chart, add spacingLeft / spacingRight, reduce chart size by "size" paramter. In case when you would like to have vertical datalabels, your can try to useHTML / formatter.

Related

Change color of range column chart in ApexCharts

I am trying to implement a waterfall chart for 1 of my projects using ApexCharts. This chart isn't available out of the box with ApexCharts. So, I'm trying to modify the range column chart into a Waterfall chart.
This is pretty much all I need but I need to change the color of the columns where the range is decreasing. Here the middle columns have a blue color, but I need to change it to red. Any leads are appreciated.
I have already checked the fill and the colors property, they don't seem to work properly with range column charts.
CodePen: https://codesandbox.io/s/apx-range-column-forked-8dv67
Thanks in advance.
The closest thing I've been able to get working is setting a fillColor for each data point in a series:
this.chartOptions = {
series: [
{
name: "blue",
data: [
{
x: "Team A",
y: [0, 100],
fillColor: "#FF0000",
},
],
},
],
}
For this to work though, you'd need to do some pre-processing before you add the data points to the series. You would need a function to check if the range is negative and if so sets the color to red.
function barColor(dataPoint1, dataPoint2) {
return (dataPoint1 - dataPoint2) < 0 ? "" : "#FF0000";
}
There's a code Sandbox showing the fillColor in use.

Removing/Hiding Null label from x-axis of Chart

I'm looking to hide the null label from my chart here. I'm working in Actuate/Opentext designer. I originally needed for there to always be 28 column slots but there isn't always data points for each of those days. If there isn't- the label on the x-axis is showing up as null. I'd like to hide this label but can't figure out how. Even changing the color of it to white but I can't get around how to manipulate this label to never show when null. Here is an image of what I'm trying to remove from my chart and the current code
beforeGeneration: function(options) { options.xAxis.max = 27
//You can change options here.
options.plotOptions = {
series: {
pointWidth: 25, //size of column
pointPadding: 0.25, //size of padding between each bar
groupPadding: 0 //padding between each value groups in x axis
}
};
},
Use formatter function:
xAxis: {
...,
labels: {
formatter: function(){
return this.value || '';
}
}
}
API Reference: https://api.highcharts.com/highcharts/xAxis.labels.formatter

Change left bar thickness and color on charts.js line chart

Unless I'm mistake, this appears to be undocumented. Does anyone know if the far left bar colour on line charts can be changed?
It seems the first left bar is always darker than the grid lines.
you need zeroLineColor
https://www.chartjs.org/docs/2.8.0/axes/styling.html?h=zerolinecolor
options = {
scales: {
xAxes: [{
gridLines: {
zeroLineColor: '#fff'
},
}
]}}
ChartJS. Change axis line color

Response highcharts datalabels on series

I have been working with http://api.highcharts.com/highcharts/plotOptions.series.dataLabels
And my current set up for labels looks like this:
plotOptions = {
column: {
stacking: 'normal',
dataLabels: {
enabled: true,
formatter() {
if(this.y != 0) {
return formatValue(this.y, prefix, suffix);
}
}
}
}
};
But the problem I have is that if my column chart has let's say 30 columns, all of the labels run into each other. I see that I can set the allowOverlap param to false and so then they would not overlap....but then it looks messy with data labels all over the chart to prevent overlap. Is there a way to configure my highcharts to just hide all datalabels if there are too many labels (too many overlaps to handle)?
I've taken a look at Removing Highchart datalabels on windows resize but ideally would like to see if highcharts handles this.

Kendo pie chart best fit labels

Is it possible to position the Kendo Pie Chart labels depending on whether there is enough room for them to fit inside the Pie Chart, just like the best fit option in Excel? So if they can fit they go inside and if they can't an arrow will point to them from the outside. Possibly similar to this: Kendo barchart category labels left and right based on value
I don't mind doing it manually if I have to because I don't think Kendo has the feature built in.
I just worked it out, it turns out kendo passes the current data item as a parameter to the position property if you set it to a function, so all I had to do was check it's percentage and if its less than 30% (or whatever you want) then it will be in the inside otherwise it will be on the outside. The same can be done with color.
$("#chart").kendoChart({
series: [ {
labels: {
visible: true,
align: "circle",
position: function(e) {
if(e.percentage < 0.1)
return "outsideEnd";
else
return "insideEnd";
},
color: function(e) {
if(e.percentage < 0.1)
return "#000";
else
return "#fff";
}
},
type: "pie",
data: [2,1,3,4,2, 5]
}]
});
http://dojo.telerik.com/ewIva/3

Categories

Resources