如何仅使用yii2扩展名在Highcharts中显示“正在加载...”消息?

时间:2018-08-23 08:38:56

标签: highcharts yii2

我正在使用Pjax在页面上渲染Highcharts。 我的查看代码:

    <?php Pjax::begin() ?>
     <?php ActiveForm::begin() ?>
     //some code there...
    <?= Html::submitButton( 'Calculate', [
            'class' => 'btn btn-primary',
            'id' => 'calculate-button',
        ]);
        ActiveForm::end();
    ?>

<?php
        if ($data) {
            echo $this->render('HolidayChart', ['data' => $data]);
        }
    ?>

Highcharts小部件:

echo  Highcharts::widget([
    'scripts' => [
        'highcharts-more'
    ],
    'htmlOptions' => ['id' => 'holidayChart-id'],
    'options' => [
        'chart' => [
            'type' => 'columnrange',
            'inverted' => true,
            'zoomType' => 'y',
        ],
        'title' => ['text' => 'Chart'],
        'inverted' => true,
        'yAxis' => [
            'title' => [],
            'type' => 'datetime',
            'dateTimeLabelFormats' =>
                [
                    'day' => '%d.%m.%Y',
                ],
            'min' => 1514764800000,
            'max' => 1546300800000
        ],
        'xAxis' => [
            'title' => ['text' => Names'],
            'categories' => $data['users'],
        ],
        'series' => [
            [
                'name' => 'Name',
                'data' => $data['data'],
            ]
        ]
    ]
]);

控制器代码:

$calculateForm = new CalculateHolidayForm();
$data = '';
if ($calculateForm->load(Yii::$app->request->post()) && $calculateForm->validate()) {
    $data = UserHoliday::calculateHoliday(UserSubgroup::findOne($calculateForm->subgroup), $calculateForm->dateRange);
}
return $this->render('about', ['calculateForm' => $calculateForm, 'data' => $data]);

我有两个问题:
1.如何在渲染图之前显示“正在加载...”消息?
2.在仅使用扩展名更新图表上的数据之前,如何显示“正在加载...”消息? (关于https://jsfiddle.net/hLj1advd/这样的内容)
非常感谢!

0 个答案:

没有答案