stekky81/yii2-jqplot

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

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

安装: 10

依赖项: 0

建议者: 0

安全: 0

星标: 0

关注者: 2

分支: 1

语言:JavaScript

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

This package is not auto-updated.

Last update: 2024-09-28 20:03:39 UTC


README

此扩展为jqPlot提供了与Yii框架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',
        ]
    ]
]);