sizeg/yii2-jqplot

此包的最新版本(v1.0.4)没有可用的许可信息。

Yii2 jqPlot小部件基于jQuery Plotting插件渲染图表和图形

安装量: 10,953

依赖: 0

建议者: 0

安全性: 0

星标: 6

关注者: 1

分支: 1

公开问题: 1

语言:JavaScript

v1.0.4 2016-08-11 07:57 UTC

This package is not auto-updated.

Last update: 2024-09-14 18:42:16 UTC


README

此扩展为jqPlotYii框架2.0提供了集成。

jqPlot是jQuery Javascript框架的一个绘图和图表插件。jqPlot可以生成具有许多功能的漂亮线图、条形图和饼图

  • 众多的图表样式选项。
  • 可自定义格式的日期坐标轴。
  • 最多9个Y轴。
  • 旋转坐标轴文本。
  • 自动趋势线计算。
  • 工具提示和数据点高亮显示。
  • 合理的默认设置,便于使用。

线条、坐标轴、阴影甚至网格本身由可插拔的"渲染器"处理。不仅绘图元素可自定义,插件还可以扩展绘图的功能!jqPlot的核心代码中有许多钩子,允许自定义事件处理程序、创建新的绘图类型、向绘图添加画布等!

Numerous line style options with 6 built in marker styles! Horizontal and vertical Bar charts! Shadow control on lines, markers, the grid, everything!

Drag and drop points with auto updating of data! Log Axes with flexible tick marks! Trend lines computed automatically!

安装

该包可在Packagist上找到,您可以使用Composer安装它。

composer require sizeg/yii2-jqplot

基本用法

echo JqPlot::widget([
    'data' => [[1, 2],[3,5.12],[5,13.1],[7,33.6],[9,85.9],[11,219.9]]
]);

以下示例将渲染一个条形图

echo JqPlot::widget([
    'data' => [
        [2, 6, 7, 10],
        [7, 5, 3, 2],
        [14, 9, 3, 8],
    ],
    'clientOptions' => [
        'stackSeries' => true,
        'captureRightClick' => true,
        'seriesDefaults'  => [
            'renderer' => new JsExpression("$.jqplot.BarRenderer"),
            'rendererOptions' => [
                'highlightMouseDown' => true,
            ],
            'pointLabels' => [
                'show' => true,
            ],
        ],
        'legend' => [
            'show' => true,
            'location' => 'e',
            'placement' => 'outside',
        ]
    ]
]);