score:1
Accepted answer
To answer your question how to create an array that holds zero values and merge with the data array (I assume).
You can use array_fill to create the array with zeros, and use array_replace to replace with the data array.
$arr = array_fill(0, 10, 0); //[0,0,0,0,0,0,0,0,0,0]
$data = [2 => 15, 5 =>10, 7 => 16]; // your data
$new = array_replace($arr, $data);
var_dump($new); // [0,0,15,0,0,10,0,16,0,0]
Source: stackoverflow.com
Related Query
- How do you set up an array to hold '0's for empty locations so graphs(Highcharts) can format them correctly?
- Highcharts - How to set custom colors for the series
- How do I set a minimum upper bound for an axis in Highcharts?
- How to set a static minimum value for axes in Highcharts
- how to set a rangeSelector for highstock
- How do I set highcharts line graph point colors to an array of colors?
- How to set the x value for High Charts error bar
- How do you set the stack order of the series in a stacked bar chart?
- How do you set the text-overflow property of a highcharts-legend-item to ellipsis in styled mode?
- How do you show grid lines for both x axis and y axis in highchart?
- How can I set the alignment for individual axis labels in highcharts?
- How to use for loop array to add series dynamically for line chart
- Highcharts - how to set textShadow for data labels
- HighCharts. How to set a fixed width for a chart grid, not including labels?
- HighCharts - how to set labels font color for printing?
- Highcharts. How to set interval for PlotBand?
- How to set column width for columnRange chart with multiple series
- How can I set the legend symbol color for a series when using colorByPoint?
- How to set a Maximum yAxis range for HighChart graph?
- How to set column colors, title colors , font size , font family in external css file for highcharts?
- How to make Javascript output brackets for an Array of Arrays. (For Highcharts)
- How to set up drilldown feature for multiple boxplot series in highcharter?
- How To Set Different Colors For Different Plots In A Same Chart?
- How can you set colors per level in a Highcharts Sunburst chart?
- Highcharts - How to set a gradient theme for each type of graph globally?
- In Highcharts, how to set up title for each pyramid in a multi-pyramid chart
- How to set border for a highcharts pie?
- How to dynamically adjust dataGrouping and set variable time intervals for HighStock data (HighCharts)
- Highcharts Theming: How to set gradient colors for certain chart types only?
- Highcharts how to make a set number of colors for pie chart data and drilldown data
More Query from same tag
- Change highcharts mapbuble type to custom images
- High charts, providing data for xAxis instead of Series
- HighCharts Add Comments
- Integrate keen.io json to highcharts js
- highcharter graph with 2 groups in r
- How to use types with typescript on highcharts.js
- streaming multiple series to highcharts
- Update series using Highcharts React wrapper
- Multiple point selection in Highcharts stockChart
- Show highcharts for database data
- Javascript: Trying to load highcharts without freezing the browser
- highcharts wrapper function for 'drag'
- How to decrease sensitivity of automatic axis adjustment in Highcharts when dragging points
- Fullscreen panel bootstrap with highcharts (responsive)
- HighCharts multiple x series data for line graph
- How to make json array name series name, array data -series data in highcharts?
- Not able to hover on each line in Highcharts's Parallel Coordinate chart
- Highcharts: yAxis title = current series name
- angular 2 Highcharts Stock Chart differences
- How to disable or remove the default HighChart loading message?
- highcharts - precision for stacked column chart data labels
- Highcharts pie/bar combo. How to load json and how are the data series expressed
- How to align the labels of sankey diagram?
- How can I move legend in Highcharts?
- two dimensional array highcharts Active Record Associations
- Clear chart by click in highcharts
- Unable to set colors in Highstock charts
- How to find a point with longitude and latitude in a Highmaps maps serie, initiated with GeoJson?
- Y-Axis Series is Duplicated in Highcharts
- Unable to load Map Chart in Angular 7 using HighMaps 7