score:1
Accepted answer
$myarray = Array (
'answer1' => Array ( 'SubQuestion 1'=> 3 , 'SubQuestion 2' => 1 ) ,
'answer2'=> Array ( 'SubQuestion 1' => 2, 'SubQuestion 2' => 2 ) ,
'answer3' => Array ( 'SubQuestion 1' => 1, 'SubQuestion 2' => 1 ) ,
'answer4' => Array ( 'SubQuestion 1' => 1, 'SubQuestion 2' => 2 ) ,
'answer5' => Array ( 'SubQuestion 1' => 0, 'SubQuestion 2' => 1 )
);
$temp = array();
$chartdata = array();
foreach($myarray as $key1 => $value1){
foreach($value1 as $key2 => $value2){
if(!in_array($key2, $temp)){
$temp[] = $key2;
}
$chartdata[array_search($key2, $temp)]['name'] = $key2;
$chartdata[array_search($key2, $temp)]['data'][] = $value2;
}
}
echo '<pre>';
print_r($chartdata);
Source: stackoverflow.com
Related Query
- Multi Series Highchart Data with Multidimensial Array
- Highchart data series filled with different colors
- Several Series with the same xAxis data in HighChart
- Adding data to a highchart chart using an array with IDs
- Updating Highchart Series Data with Formatted AJAX Return
- Extract data series from a JSON array for a Highcharts chart with 2 y-axis
- How do I add an array of data points to a Highchart series
- Highchart Line chart – data series with multiple axis - 2nd series placed in the middle of X axis
- Highcharts series visibility with csv data source
- How to redraw highchart series with json data value?
- How to have multiple highcharts with different series data in vuejs without repeating code
- Highchart - change data series with link
- Highchart Color Issue for series with single data with multiple colors
- set series driildown data with looping from array
- Highchart Data from HTML table with line series
- plotting dynamic array data structure with highchart
- Highcharts: How to set colors per column, per series, with a data set, in a multi series chart?
- highchart bar using json with series and xAxis data
- how to pass multi sereis data with dual y axis chart in highchart
- Highcharts doesn't display series with lots of data points
- Reduce gap between series data in Bar Highchart
- Highcharts data series issue with ajax/json and PHP
- creating highchart with ajax json data
- Plot Highchart Gauge with JSON Data
- Highcharts series data array
- HighChart Heatmap with JSON data
- How to display highchart y axis with constistant data
- Use an array of objects for series data in Highcharts
- Highchart (Column Chart) : Few data labels are not appearing for a series
- Highcharts with JSON data and multiple series
More Query from same tag
- Is there a maximum number of x-Axis items in HighCharts
- Highcharts - How can I show arrow between two dials of gauge chart?
- How can I wrap long text labels in highchart nested groups
- change the color of Highmap
- Highchart not rendering data from dynamically created array array
- How to remove the value and number labels from Highcharts angular gauge
- How to change high and low whisker color in boxplot highcharts?
- Plotline (vertical line) in highcharts scatter chart
- How to include RSI and Volume in the same chart?
- Error using Highcharts (>= 8.0.1) function stockChart() in Angular
- Highcharts naming of individual bubbles
- Highstock Chart - I want the chart to start at position 0% (beginning) on the x-axis
- Highcharts - data day sum one day ahead
- Plot aspect ratio
- Can we create pie chart and scatter plot combined using highcharts.js?
- How to change marker symbol based on value in angularjs
- Populating data to Highstock
- Highcharts: How to set colors per column, per series, with a data set, in a multi series chart?
- Highcharts add a new data point
- highcharts - render text with decimal 'x' and 'y'
- DrillDown in multiple line graphs
- how to make above highchart graph responsive on window resize?
- Highmaps support for zip5
- Can't get map to work with highcharts-vue
- Format number data with comma and unit in Highchart
- Add a bar independent of categories ("reference" bar)
- Total valued figures often overlapping with bars in Highcharts Barchart
- change background color for highchart candlestick plot
- How to extract Min and Max date from Highcharter stock graph?
- Set line opacity in highchart line chart