Support » Plugin: Easy Charts » Colours

  • Resolved amkwa

    (@amkwa)


    Hi,

    Great plugin.

    I would like to find out how I can have just one colour for the Bar Chart. I would also like to know if it is possible to not have it change colour when it hovers.

    Regards

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Kiran Potphode

    (@kiranpotphode)

    Hi @amkwa,

    These are some missing features from the current version of the plugin. I will add them in upcoming versions.
    Till then to keep going I am providing you with some code snippets to meet your requirements.

    I would like to find out how I can have just one colour for the Bar Chart

    function easy_charts_get_chart_configurations_callback( $ec_chart_option, $chart_id, $meta_key  ){
    
    	if( $chart_id == 25 && $meta_key == 'graph' ){
    
    		$ec_chart_option['custompalette'] = array(
    				'#333333',
    				'#333333',
    				'#333333',
    				'#333333',
    		);
    
    	}
    
    	return $ec_chart_option;
    }
    add_filter( 'easy_charts_get_chart_configurations', 'easy_charts_get_chart_configurations_callback', 10, 3 );

    In above code snippets replace chart_id and color code for custompalette. You can repeat the color in the array up to a number of categories you are using in the chart.

    I would also like to know if it is possible to not have it change colour when it hovers

    function easy_charts_get_chart_data_callback( $ec_chart_data, $chart_id ){
    	if( $chart_id == 25 ){
    
    		$ec_chart_data['chart_configuration']['effects'] = array(
    				'hovercolor' => '#333333',
    		);
    	}
    
    	return $ec_chart_data;
    }
    
    add_filter( 'easy_charts_get_chart_data', 'easy_charts_get_chart_data_callback', 10, 2 );

    In above code snippet, you have to change chart_id and color code you specified in the previous code snippet.

    You can put these code snippets in functions.php file of the active theme.

    Hope this is will do what you need. Feel free to ask if you need any help with this.

    Regards

    amkwa

    (@amkwa)

    Thank you so much for replying. This is going to sound so embarrassing, I do not know where to place that. I can tell what my chart ID is and I have the colour code but thats it.

    Please help

    Plugin Author Kiran Potphode

    (@kiranpotphode)

    Hi @amkwa,

    Have a look at this plugin. This might be helpful.
    https://wordpress.org/plugins/my-custom-functions/

    Just replace chart ID and colour code in above code snippets.

    amkwa

    (@amkwa)

    Hi Kiran,

    This helped a lot. Thank you so much.

    Regards,

    Gotlieb

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Colours’ is closed to new replies.