File tree Expand file tree Collapse file tree 3 files changed +15
-4
lines changed
classes/Visualizer/Module Expand file tree Collapse file tree 3 files changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -750,7 +750,7 @@ private function _handleTypesPage() {
750
750
update_post_meta ( $ this ->_chart ->ID , Visualizer_Plugin::CF_SERIES , $ source ->getSeries () );
751
751
}
752
752
753
- Visualizer_Module_Utility::set_defaults ( $ this ->_chart , $ type , $ library );
753
+ Visualizer_Module_Utility::set_defaults ( $ this ->_chart );
754
754
755
755
// redirect to next tab
756
756
// changed by Ash/Upwork
@@ -970,9 +970,15 @@ public function uploadData() {
970
970
update_post_meta ( $ chart ->ID , Visualizer_Plugin::CF_SERIES , $ source ->getSeries () );
971
971
update_post_meta ( $ chart ->ID , Visualizer_Plugin::CF_SOURCE , $ source ->getSourceName () );
972
972
update_post_meta ( $ chart ->ID , Visualizer_Plugin::CF_DEFAULT_DATA , 0 );
973
+
974
+ Visualizer_Module_Utility::set_defaults ( $ chart , null );
975
+
976
+ $ settings = get_post_meta ( $ chart ->ID , Visualizer_Plugin::CF_SETTINGS , true );
977
+
973
978
$ render ->id = $ chart ->ID ;
974
979
$ render ->data = json_encode ( $ source ->getRawData () );
975
980
$ render ->series = json_encode ( $ source ->getSeries () );
981
+ $ render ->settings = json_encode ( $ settings );
976
982
} else {
977
983
$ render ->message = esc_html__ ( 'CSV file is broken or invalid. Please, try again. ' , 'visualizer ' );
978
984
}
Original file line number Diff line number Diff line change @@ -125,8 +125,11 @@ private static function get_random_color() {
125
125
*
126
126
* @access public
127
127
*/
128
- public static function set_defaults ( $ chart , $ type , $ library ) {
129
- if ( $ chart ->post_status !== 'auto-draft ' || $ library !== 'ChartJS ' ) {
128
+ public static function set_defaults ( $ chart , $ post_status = 'auto-draft ' ) {
129
+ $ type = get_post_meta ( $ chart ->ID , Visualizer_Plugin::CF_CHART_TYPE , true );
130
+ $ library = get_post_meta ( $ chart ->ID , Visualizer_Plugin::CF_CHART_LIBRARY , true );
131
+
132
+ if ( ( ! is_null ( $ post_status ) && $ chart ->post_status !== $ post_status ) || $ library !== 'ChartJS ' ) {
130
133
return ;
131
134
}
132
135
Original file line number Diff line number Diff line change 292
292
for ( j = 0 ; j < atts . length ; j ++ ) {
293
293
var values = [ ] ;
294
294
for ( var i = 0 ; i < rows . length ; i ++ ) {
295
- values . push ( settings . slices [ i ] [ atts [ j ] ] ) ;
295
+ if ( typeof settings . slices [ i ] !== 'undefined' && typeof settings . slices [ i ] [ atts [ j ] ] !== 'undefined' ) {
296
+ values . push ( settings . slices [ i ] [ atts [ j ] ] ) ;
297
+ }
296
298
}
297
299
var object = { } ;
298
300
object [ atts [ j ] ] = values ;
You can’t perform that action at this time.
0 commit comments