score:0
Accepted answer
i have a solution. i add a new auxiliary array, according to the data object.
import { component, oninit, eventemitter } from '@angular/core';
@component({
selector: 'app-comb',
templateurl: './comb.component.html',
styleurls: ['./comb.component.scss']
})
export class combcomponent implements oninit {
@output() onclickcolumn = new eventemitter();
options;
data = {
reported: [0, 0, 3, 7, 8, 7, 7, 0, 0, 0, 3, 8, 8, 6, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
npl: [0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
overtimes: [0, 0, 1, 3, 0, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
required: [0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
weekends: [8, 8, 0, 0, 0, 0, 0, 8, 8, 0, 0, 0, 0, 0, 8, 8, 0, 0, 0, 0, 0, 8, 8, 0, 0, 0, 0, 0, 8, 8, 0],
expected: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 8, 8, 0, 0, 8, 8, 8, 7, 8, 0, 0, 8],
future_plan: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
}
auxdata: array<number> = [];
constructor() {}
ngoninit() {
this.createauxdata();
this.options = {
chart: {
type: 'column'
},
credits: {
enabled: false
},
title: {
text: null
},
legend: {
enabled: false
},
tooltip: {
enabled: false
},
xaxis: {
categories: [ "2016-12-01", "2016-12-02", "2016-12-03", "2016-12-04", "2016-12-05", "2016-12-06", "2016-12-07", "2016-12-08", "2016-12-09", "2016-12-10", "2016-12-11", "2016-12-12", "2016-12-13", "2016-12-14", "2016-12-15", "2016-12-16", "2016-12-17", "2016-12-18", "2016-12-19", "2016-12-20", "2016-12-21", "2016-12-22", "2016-12-23", "2016-12-24", "2016-12-25", "2016-12-26", "2016-12-27", "2016-12-28", "2016-12-29", "2016-12-30", "2016-12-31" ],
labels: {
formatter: function () {
if (this.value.status === 'weekend') {
return `
<span>${moment(this.value.date).format('dd')}</span>
<br>
<span>${moment(this.value.date).format('dd')}</span>`;
} else if (this.value.status === 'now') {
return `
<span style="color: blue">${moment(this.value.date).format('dd')}</span>
<br>
<span style="color: blue">${moment(this.value.date).format('dd')}</span>`;
} else {
return `
<span style="color: black">${moment(this.value.date).format('dd')}</span>
<br>
<span style="color: black">${moment(this.value.date).format('dd')}</span>`;
}
}
},
ticklength: 40
},
yaxis: {
tickpositions: [0, 4, 8, 10],
endontick: false,
ceiling: 24,
title: {
text: null
}
},
plotoptions: {
column: {
stacking: 'normal',
},
series: {
allowpointselect: true,
states: {
select: {
color: null,
borderwidth: 1,
bordercolor: 'blue'
}
},
pointwidth: 30,
datalabels: {
usehtml: true,
enabled: true,
color: 'black',
style: {
fontsize: '9px'
},
verticalalign: 'top',
formatter: function() {
if (moment().isbefore(this.point.category.date)) {
return;
} else {
if (this.point.category.status === 'now') {
this.point.bordercolor = 'blue';
}
if (this.y !== 0) {
return this.y;
}
}
}
},
cursor: 'pointer',
}
},
series: [
{
name: 'diff',
color: 'rgba(255, 255, 255, 0.8)',
bordercolor: 'rgb(194, 194, 194)',
borderwidth: 1,
datalabels: false,
data: this.data.expected
},
{
name: 'weekend',
color: 'rgba(194, 194, 194, 0.4)',
bordercolor: 'rgb(194, 194, 194)',
borderwidth: 1,
datalabels: false,
data: this.data.weekends
},
{
name: 'overtimes',
color: 'rgba(243, 183, 74, 0.8)',
bordercolor: 'rgb(194, 194, 194)',
borderwidth: 1,
data: this.data.overtimes
},
{
name: 'auxdata',
color: 'rgb(255, 255, 255)',
bordercolor: 'rgb(194, 194, 194)',
borderwidth: 1,
datalabels: false,
data: this.auxdata
},
{
name: 'loged hours',
color: 'rgba(26, 179, 148, 0.8)',
bordercolor: 'rgb(26, 179, 148)',
borderwidth: 1,
data: this.data.reported
},
{
name: 'npa',
color: 'rgba(28, 132, 198, 0.8)',
bordercolor: 'rgb(28, 132, 198)',
borderwidth: 1,
data: this.data.npl
},
{
name: 'no report',
color: 'rgba(255, 255, 255, 0.8)',
bordercolor: 'rgb(237, 85, 101)',
borderwidth: 1,
data: this.data.required
},
{
name: 'report not send',
color: 'rgba(237, 85, 101, 0.8)',
bordercolor: 'rgb(237, 85, 101)',
borderwidth: 1,
data: this.data.future_plan
}
]
};
}
createauxdata() {
for (var i = 0; i < this.data.reported.length; i++) {
if (this.data.reported[i] !== 0 && (this.data.reported[i] + this.data.npl[i]) < 8) {
var diff = 8 - this.data.reported[i] - this.data.npl[i];
this.auxdata.push(8 - this.data.reported[i] - this.data.npl[i]);
} else {
this.auxdata.push(0);
}
}
}
onclick(e) {
if (!e.point) {
return false;
} else {
this.onclickcolumn.emit(e.point.category.date);
}
}
}
Source: stackoverflow.com
Related Query
- How to add space between series in stacked columns in HighChart?
- How can I do in Highchart to have 1px space between the columns and the y Axis?
- How to add space between plotband and first bar(red color "A" bar) in highchart
- How to add space between chart and axis in highcharts
- Highcharts: How to remove tiny space between stacked bars/columns
- In highcharts's stacked bar chart, how can I remove the white space between different
- Waterfall Highchart to start some of the columns in between the series with 0 y-axis
- HighCharts - Remove space between series on stacked bar
- How to add comma in stacked column highchart in indian format?
- How to Change space between series data colums in highcharts?
- how to add an color picker control to highchart for changing the color of series by user
- Highchart - how to control gap between series
- How do I add an array of data points to a Highchart series
- How to add a vertical plot line in multiple line series and show the tooltip on Plot line in highchart
- How to add another series into my highchart
- highchart stacked bar chat add series dynamically
- solution : Manage space between group columns in highchart
- How to add footer for each series stacked horizontal bars in highcharts?
- How to add different series data for each categories in Stacked Column chart in Highcharts?
- How add the straight line between bubbles in highchart
- How to remove space between highChart bar graph between two different category
- Highchart Columns - Space between columns not changing
- Highcharts how do i keep space between series the same but increase space between categories?
- how to divide two columns on series with json in highchart
- How to prevent my stacked series from being in reverse order?
- How to display highchart series line marker symbol from tooltip formatter?
- Reduce gap between series data in Bar Highchart
- Space between columns
- Add a gap between the second and third series in a Highcharts column plot with four series displayed
- How to add a newline to a Highchart tooltip?
More Query from same tag
- How to do enhanced\group label\hierarchical label x-axis
- How to show full date to my labels and each x axis in different colour in highcharts?
- customEvents.js and H.removeEvents conflict
- It's not possible load Highstock from the CDN as an AMD module
- how to sort and select top 5 elements in a json array using angular JS
- How to "Pause" Highcharts selection event
- Different color for plot outside range
- Django HighChart with Api
- Revert theme to default
- Modify the size of the tickPositions in HighCharts
- JSON string to Highcharts
- Creating a marimekko chart using Highcharts
- Column chart in Highcharts - select series with a click
- SplitSeries does not work in Packed Bubble Highchart in r
- Highchart tooltip does not match series colour - Solid Gauge Chart
- Highcharts: Dynamically change / add axis attributes
- Highcharts Dynamic Updated Highstock Charts doesn't display along with Bar Chart
- ERROR TypeError: series.addPoint is not a function - Angular highcharts
- Highcharts stock control range when rangeSelector hidden
- Error in rendering a React highcharts x-range chart
- rCharts::rPlot on click event
- How to get Highcharts xAxis co-ordinate?
- How to add vertical (and horizontal) line in highcharts scatter plot
- Show all labels in highcharts horizontal bar graph
- Highcharts conditional data label
- Highcharts not showing tooltip after update from null
- missing the last element of the line
- Highchart Heatmap remove empty rows on legend toggle
- Highcharts only loads Title / Subtitle
- Show tooltips on all points of vertical line