Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- foreach ($barDateDatas as $i => $barDateData) :
- foreach ($barDateData as $dataKeys => $datapoints) :
- if ($dataKeys == 'x') :
- $barDateDatas[$i][$dataKeys] = date("d/m/Y", strtotime($datapoints));
- endif;
- if ($dataKeys == 'y') :
- $barDateDatas[$i][$dataKeys] = str_replace(',', '.', $datapoints);
- endif;
- if ($dataKeys == 'fillcolor') :
- unset($barDateDatas[$i][$dataKeys]);
- $barDateDatas[$i][str_replace('fillcolor', 'fillColor', $dataKeys)] = $datapoints;
- endif;
- //formate the markers data for apexCharts
- $markerArray = array_slice($barDateData, 5);
- unset($barDateDatas[$i]['markername']);
- unset($barDateDatas[$i]['markervalue']);
- unset($barDateDatas[$i]['markerstrokecolor']);
- unset($barDateDatas[$i]['markerstrokewidth']);
- unset($barDateDatas[$i]['markerstrokeheight']);
- unset($barDateDatas[$i]['markerstrokedasharray']);
- unset($barDateDatas[$i]['markerstrokelinecap']);
- foreach($markerArray as $markerKey => $markerValue) :
- if ($markerKey == 'markername') :
- unset($markerArray[$markerKey]);
- $markerArray[str_replace('markername', 'name', $markerKey)] = $markerValue;
- endif;
- if ($markerKey == 'markervalue') :
- unset($markerArray[$markerKey]);
- $markerArray[str_replace('markervalue', 'value', $markerKey)] = $markerValue;
- endif;
- if ($markerKey == 'markerstrokecolor') :
- unset($markerArray[$markerKey]);
- $markerArray[str_replace('markerstrokecolor', 'strokeColor', $markerKey)] = $markerValue;
- endif;
- if ($markerKey == 'markerstrokewidth') :
- unset($markerArray[$markerKey]);
- $markerArray[str_replace('markerstrokewidth', 'strokeWidth', $markerKey)] = $markerValue;
- endif;
- if ($markerKey == 'markerstrokeheight') :
- unset($markerArray[$markerKey]);
- $markerArray[str_replace('markerstrokeheight', 'strokeHeight', $markerKey)] = $markerValue;
- endif;
- if ($markerKey == 'markerstrokedasharray') :
- unset($markerArray[$markerKey]);
- $markerArray[str_replace('markerstrokedasharray', 'strokeDashArray', $markerKey)] = $markerValue;
- endif;
- if ($markerKey == 'markerstrokelinecap') :
- unset($markerArray[$markerKey]);
- $markerArray[str_replace('markerstrokelinecap', 'strokeLineCap', $markerKey)] = $markerValue;
- endif;
- endforeach;
- $markerData = ['goals' => [$markerArray]];
- endforeach;
- $barDateDatas[$i][$dataKeys] = $markerData;
- endforeach;
- $barDateData = json_encode($barDateDatas);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement