Create a chart showing where events occurred.

@param string $chart_shows The type of chart map to show
@param string $chart_type  The type of chart to show
@param string $surname     The surname for surname based distribution chart

@return string
550871
public function chartDistribution(
        string $chart_shows = 'world',
        string $chart_type = '',
        string $surname = ''
    ): string {
        I18N::init(WT_LOCALE);

        switch ($chart_type) {
            case 'surname_distribution_chart':
                $chart_title = I18N::translate('Surname distribution chart') . ': ' . $surname;
                $data        = $this->getSurnameChartData($surname);
                break;

            case 'birth_distribution_chart':
                $chart_title = I18N::translate('Birth by country');
                $data        = $this->getBirthChartData();
                break;

            case 'death_distribution_chart':
                $chart_title = I18N::translate('Death by country');
                $data        = $this->getDeathChartData();
                break;

            case 'marriage_distribution_chart':
                $chart_title = I18N::translate('Marriage by country');
                $data        = $this->getMarriageChartData();
                break;

            case 'indi_distribution_chart':
            default:
                $chart_title = I18N::translate('Individual distribution chart');
                $data        = $this->getIndivdualChartData();
                break;
        }

        $chart_color2 = $this->theme->parameter('distribution-chart-high-values');
        $chart_color3 = $this->theme->parameter('distribution-chart-low-values');

        return view(
            'statistics/other/charts/geo',
            [
                'chart_title'  => $chart_title,
                'chart_color2' => $chart_color2,
                'chart_color3' => $chart_color3,
                'region'       => $chart_shows,
                'data'         => $data,
            ]
        );
    }
779438
public function chartChildren(): string
    {
        $data = [
            [
                I18N::translate('Century'),
                I18N::translate('Average number')
            ]
        ];

        foreach ($this->queryRecords() as $record) {
            $data[] = [
                $this->century_service->centuryName((int) $record->century),
                (float) $record->num
            ];
        }

        $chart_title   = I18N::translate('Average number of children per family');
        $chart_options = [
            'title' => $chart_title,
            'subtitle' => '',
            'legend' => [
                'position'  => 'none',
            ],
            'vAxis' => [
                'title' => I18N::translate('Number of children'),
            ],
            'hAxis' => [
                'title' => I18N::translate('Century'),
            ],
            'colors' => [
                '#84beff'
            ],
        ];

        return view(
            'statistics/other/charts/column',
            [
                'data'          => $data,
                'chart_options' => $chart_options,
                'chart_title'   => $chart_title,
            ]
        );
    }
955802
public function chartMortality(
        int $tot_l,
        int $tot_d,
        string $color_living = null,
        string $color_dead = null
    ): string {
        $color_living = $color_living ?? '#ffffff';
        $color_dead   = $color_dead   ?? '#cccccc';

        $data = [
            [
                I18N::translate('Century'),
                I18N::translate('Total')
            ]
        ];

        if ($tot_l || $tot_d) {
            $data[] = [
                I18N::translate('Living'),
                $tot_l
            ];

            $data[] =  [
                I18N::translate('Dead'),
                $tot_d
            ];
        }

        $colors = $this->color_service->interpolateRgb($color_living, $color_dead, count($data) - 1);

        return view(
            'statistics/other/charts/pie',
            [
                'title'            => null,
                'data'             => $data,
                'colors'           => $colors,
                'labeledValueText' => 'percentage',
            ]
        );
    }
1314399
def _chart(self, x, y, chart_type, opts, style, label, options, **kwargs):
		
		if opts is not None:
			self.chart_opts = opts
		if style is not None:
			self.chart_style = style
		if label is not None:
			self.label = label
		self.x = x
		self.y = y
		if chart_type is None:
			return
		try:
			chart_obj = self._get_chart(chart_type, x, y, style=style,
										opts=opts, label=label,
										options=options, **kwargs)
			return chart_obj
		except Exception as e:
			self.err(e)
148829
public function renderChart()
    {
        $displayChart = (!empty($this->grid->chartOptions) && @$this->grid->chartOptions['data'] && $this->grid->dataProvider->getItemCount(
                ));

        if (!$displayChart || $this->grid->dataProvider->getItemCount() <= 0) {

            return null;
        }

        if (!isset($this->grid->chartOptions['data']['series'])) {
            throw new CException(Yii::t(
                'zii',
                'You need to set the "series" attribute in order to render a chart'
            ));
        }

        $configSeries = $this->grid->chartOptions['data']['series'];
        if (!is_array($configSeries)) {
            throw new CException(Yii::t('zii', '"chartOptions.series" is expected to be an array.'));
        }

        if (!isset($this->grid->chartOptions['config'])) {
            $this->grid->chartOptions['config'] = array();
        }

        $this->renderChartControlButtons();
        $chartId = $this->grid->registerChartControlButtonsScript();

        // render Chart
        // chart options
        $data = $this->grid->dataProvider->getData();
        $count = count($data);
        $seriesData = array();
        $cnt = 0;
        foreach ($configSeries as $set) {
            $seriesData[$cnt] = array('name' => isset($set['name']) ? $set['name'] : null, 'data' => array());

            for ($row = 0; $row < $count; ++$row) {
                $column = $this->grid->getColumnByName($set['attribute']);
                if (!is_null($column) && $column->value !== null) {
                    $seriesData[$cnt]['data'][] = $this->evaluateExpression(
                        $column->value,
                        array('data' => $data[$row], 'row' => $row)
                    );
                } else {
                    $value = CHtml::value($data[$row], $set['attribute']);
                    $seriesData[$cnt]['data'][] = is_numeric($value) ? (float)$value : $value;
                }

            }
            ++$cnt;
        }

        $options = CMap::mergeArray($this->grid->chartOptions['config'], array('series' => $seriesData));

        $this->grid->chartOptions['htmlOptions'] = isset($this->grid->chartOptions['htmlOptions'])
            ? $this->chartOptions['htmlOptions']
            : array();

        // sorry but use a class to provide styles, we need this
        $this->grid->chartOptions['htmlOptions']['style'] = 'display:none';

        // build unique ID
        // important!
        echo '<div class="row-fluid">';
        if ($this->grid->ajaxUpdate !== false) {
            if (isset($options['chart']) && is_array($options['chart'])) {
                $options['chart']['renderTo'] = $chartId;
            } else {
                $options['chart'] = array('renderTo' => $chartId);
            }
            $jsOptions = CJSON::encode($options);

            if (isset($this->grid->chartOptions['htmlOptions']['data-config'])) {
                unset($this->grid->chartOptions['htmlOptions']['data-config']);
            }

            echo "<div id='{$chartId}' " . CHtml::renderAttributes(
                    $this->grid->chartOptions['htmlOptions']
                ) . " data-config='{$jsOptions}'></div>";

            $this->grid->componentsAfterAjaxUpdate[] = "highchart{$chartId} = new Highcharts.Chart($('#{$chartId}').data('config'));";
        }
        $configChart = array(
            'class' => 'yiiwheels.widgets.highcharts.WhHighCharts',
            'id' => $chartId,
            'pluginOptions' => $options,
            'htmlOptions' => $this->grid->chartOptions['htmlOptions']
        );
        $chart = Yii::createComponent($configChart);
        $chart->init();
        $chart->run();
        echo '</div>';
    }
271898
@Override protected void handleEvents(final String EVENT_TYPE) {
        super.handleEvents(EVENT_TYPE);

        if ("VISIBILITY".equals(EVENT_TYPE)) {
            Helper.enableNode(titleText, !tile.getTitle().isEmpty());
            Helper.enableNode(text, tile.isTextVisible());
            chartCanvas.setWidth(tile.isTextVisible() ? size * 0.68 : size * 0.795);
            chartCanvas.setHeight(tile.isTextVisible() ? size * 0.68 : size * 0.795);
        }
    }
1268014
def get_chart(self, id, **kwargs):
        "
        resp = self._get_object_by_name(self._CHART_ENDPOINT_SUFFIX, id,
                                        **kwargs)
        return resp
909296
public function statsBirth(string $color_from = null, string $color_to = null): string
    {
        return (new ChartBirth($this->tree))
            ->chartBirth($color_from, $color_to);
    }
1176211
function(chart) {
		var cache = chart.$plugins || (chart.$plugins = {});
		if (cache.id === this._cacheId) {
			return cache.descriptors;
		}

		var plugins = [];
		var descriptors = [];
		var config = (chart && chart.config) || {};
		var options = (config.options && config.options.plugins) || {};

		this._plugins.concat(config.plugins || []).forEach(function(plugin) {
			var idx = plugins.indexOf(plugin);
			if (idx !== -1) {
				return;
			}

			var id = plugin.id;
			var opts = options[id];
			if (opts === false) {
				return;
			}

			if (opts === true) {
				opts = helpers.clone(defaults.global.plugins[id]);
			}

			plugins.push(plugin);
			descriptors.push({
				plugin: plugin,
				options: opts || {}
			});
		});

		cache.descriptors = descriptors;
		cache.id = this._cacheId;
		return descriptors;
	}
695714
function (chart, options) {
		
		var legend = this,
			itemStyle = options.itemStyle,
			padding = pick(options.padding, 8),
			itemMarginTop = options.itemMarginTop || 0;
	
		this.options = options;

		if (!options.enabled) {
			return;
		}
	
		legend.baseline = pInt(itemStyle.fontSize) + 3 + itemMarginTop; // used in Series prototype
		legend.itemStyle = itemStyle;
		legend.itemHiddenStyle = merge(itemStyle, options.itemHiddenStyle);
		legend.itemMarginTop = itemMarginTop;
		legend.padding = padding;
		legend.initialItemX = padding;
		legend.initialItemY = padding - 5; // 5 is the number of pixels above the text
		legend.maxItemWidth = 0;
		legend.chart = chart;
		legend.itemHeight = 0;
		legend.lastLineHeight = 0;

		// Render it
		legend.render();

		// move checkboxes
		addEvent(legend.chart, 'endResize', function () { 
			legend.positionCheckboxes();
		});

	}
464074
protected function chart(Individual $individual, int $generations, bool $show_spouse): ResponseInterface
    {
        $this->layout = 'layouts/ajax';

        return $this->viewResponse('modules/hourglass-chart/chart', [
            'generations' => $generations,
            'individual'  => $individual,
            'show_spouse' => $show_spouse,
        ]);
    }
256137
def add_chart(chart_type, options)
      @drawing ||= Drawing.new worksheet
      drawing.add_chart(chart_type, options)
    end
1283650
def write_c_chart(id)
      schema  = 'http://schemas.openxmlformats.org/'
      xmlns_c = "#{schema}drawingml/2006/chart"
      xmlns_r = "#{schema}officeDocument/2006/relationships"


      attributes = [
                    ['xmlns:c', xmlns_c],
                    ['xmlns:r', xmlns_r]
                   ]
      attributes << r_id_attributes(id)

      @writer.empty_tag('c:chart', attributes)
    end
238576
public function getChartAction(ServerRequestInterface $request, Tree $tree, UserInterface $user, ChartService $chart_service): ResponseInterface
    {
        $ajax       = (bool) ($request->getQueryParams()['ajax'] ?? false);
        $xref       = $request->getQueryParams()['xref'] ?? '';
        $individual = Individual::getInstance($xref, $tree);

        Auth::checkIndividualAccess($individual);
        Auth::checkComponentAccess($this, 'chart', $tree, $user);

        $chart_style = $request->getQueryParams()['chart_style'] ?? self::DEFAULT_STYLE;
        $generations = (int) ($request->getQueryParams()['generations'] ?? self::DEFAULT_GENERATIONS);

        $generations = min($generations, self::MAXIMUM_GENERATIONS);
        $generations = max($generations, self::MINIMUM_GENERATIONS);

        if ($ajax) {
            return $this->chart($request, $tree, $chart_service);
        }

        $ajax_url = $this->chartUrl($individual, [
            'chart_style' => $chart_style,
            'generations' => $generations,
            'ajax'        => true,
        ]);

        return $this->viewResponse('modules/descendancy_chart/page', [
            'ajax_url'            => $ajax_url,
            'chart_style'         => $chart_style,
            'chart_styles'        => $this->chartStyles(),
            'default_generations' => self::DEFAULT_GENERATIONS,
            'generations'         => $generations,
            'individual'          => $individual,
            'maximum_generations' => self::MAXIMUM_GENERATIONS,
            'minimum_generations' => self::MINIMUM_GENERATIONS,
            'module_name'         => $this->name(),
            'title'               => $this->chartTitle($individual),
        ]);
    }
1254541
@Override protected void handleEvents(final String EVENT_TYPE) {
        super.handleEvents(EVENT_TYPE);
        if ("RECALC".equals(EVENT_TYPE)) {
            minValue = gauge.getMinValue();
            maxValue = gauge.getMaxValue();
            range    = gauge.getRange();
            redraw();
        } else if ("VISIBILITY".equals(EVENT_TYPE)) {
            Helper.enableNode(titleText, !gauge.getTitle().isEmpty());
            Helper.enableNode(valueText, gauge.isValueVisible());
            Helper.enableNode(unitText, !gauge.getUnit().isEmpty());
            Helper.enableNode(subTitleText, !gauge.getSubTitle().isEmpty());
            Helper.enableNode(averageLine, gauge.isAverageVisible());
            Helper.enableNode(averageText, gauge.isAverageVisible());
            Helper.enableNode(stdDeviationArea, gauge.isAverageVisible());
            redraw();
        } else if ("SECTION".equals(EVENT_TYPE)) {

        } else if ("ALERT".equals(EVENT_TYPE)) {

        } else if ("VALUE".equals(EVENT_TYPE)) {
            if(gauge.isAnimated()) { gauge.setAnimated(false); }
            if (!gauge.isAveragingEnabled()) { gauge.setAveragingEnabled(true); }
            double value = clamp(minValue, maxValue, gauge.getValue());
            addData(value);
            drawChart(value);
        } else if ("AVERAGING_PERIOD".equals(EVENT_TYPE)) {
            noOfDatapoints = gauge.getAveragingPeriod();
            // To get smooth lines in the chart we need at least 4 values
            if (noOfDatapoints < 4) throw new IllegalArgumentException("Please increase the averaging period to a value larger than 3.");
            for (int i = 0; i < noOfDatapoints; i++) { dataList.add(minValue); }
            pathElements.clear();
            pathElements.add(0, new MoveTo());
            for (int i = 1 ; i < noOfDatapoints ; i++) { pathElements.add(i, new LineTo()); }
            sparkLine.getElements().setAll(pathElements);
            redraw();
        }
    }
1292660
public function gchartTrendlines(\Twig_Environment $env, $data, $id, $width, $height, $title = null, $xLabel = null, $yLabel = null, $config = array(), $events = array()) {
        if (!is_null($xLabel)) {
            $hAxis = isset($config['hAxis'])? $config['hAxis']: array();
            $hAxis['title'] = $xLabel;
            $config['hAxis'] = $hAxis;
        }
        if (!is_null($yLabel)) {
            $vAxis = isset($config['vAxis'])? $config['vAxis']: array();
            $vAxis['title'] = $yLabel;
            $config['vAxis'] = $vAxis;
        }

        return $this->renderGChart($env, $data, $id, 'Trendlines', $width, $height, $title, $config, false, $events);
    }
1167070
@Override protected void handleEvents(final String EVENT_TYPE) {
        super.handleEvents(EVENT_TYPE);
        if ("RECALC".equals(EVENT_TYPE)) {
            referenceValue = tile.getReferenceValue() < maxValue ? maxValue : tile.getReferenceValue();
            angleStep      = ANGLE_RANGE / range;
            sum            = dataList.stream().mapToDouble(ChartData::getValue).sum();
            sections       = tile.getSections();
            redraw();
            setBar(tile.getCurrentValue());
        } else if ("VISIBILITY".equals(EVENT_TYPE)) {
            enableNode(titleText, !tile.getTitle().isEmpty());
            enableNode(text, tile.isTextVisible());
            enableNode(unitText, !tile.getUnit().isEmpty());
            enableNode(descriptionText, tile.isValueVisible());
        }
    }