/**
  * Output the Category Earnings Mix Pie Chart
  *
  * @since  2.4
  * @return string The HTML for the outputted graph
  */
 public function output_earnings_graph()
 {
     if (empty($this->items)) {
         return;
     }
     $data = array();
     foreach ($this->items as $item) {
         if (!empty($item['is_child']) || empty($item['total_earnings_raw'])) {
             continue;
         }
         $data[$item['label']] = $item['total_earnings_raw'];
     }
     // Sort High to Low, prior to filter so people can reorder if they please
     arsort($data);
     $data = apply_filters('edd_category_earnings_graph_data', $data);
     $options = apply_filters('edd_category_earnings_graph_options', array('legend_formatter' => 'eddLegendFormatterEarnings'), $data);
     $pie_graph = new EDD_Pie_Graph($data, $options);
     $pie_graph->display();
 }
 /**
  * Output the Category Earnings Mix Pie Chart
  *
  * @since  2.4
  * @return string The HTML for the outputted graph
  */
 public function output_earnings_graph()
 {
     if (empty($this->items)) {
         return;
     }
     $data = array();
     $total_earnings = 0;
     foreach ($this->items as $item) {
         $total_earnings += $item['total_earnings_raw'];
         if (!empty($item['is_child']) || empty($item['total_earnings_raw'])) {
             continue;
         }
         $data[$item['label']] = $item['total_earnings_raw'];
     }
     if (empty($total_earnings)) {
         echo '<p><em>' . __('No earnings for dates provided.', 'easy-digital-downloads') . '</em></p>';
     }
     // Sort High to Low, prior to filter so people can reorder if they please
     arsort($data);
     $data = apply_filters('edd_category_earnings_graph_data', $data);
     $options = apply_filters('edd_category_earnings_graph_options', array('legend_formatter' => 'eddLegendFormatterEarnings'), $data);
     $pie_graph = new EDD_Pie_Graph($data, $options);
     $pie_graph->display();
 }