pyxley,基于Python的数据可视化面板

Pyxley

The Pyxley python library makes use of the pyxleyJS React components to create Flask-based web applications. Through the use of the PyReact library, we can use Jinja templating to construct and transform a single React component. The specific UI components are passed as props to the parent component. A simpler interface is provide through the use of specific wrappers for each of the component types.

10100725_pvh1.jpg

An example of the Jinja template for a single React component is presented below.

    _react = (    """    var Component = require("{{path}}").{{name}};    {{vars}}    React.render(        <Component        {{props}} />,        document.getElementById("{{id}}")    );    """)

By constructing the template in this way, the developer can easily integrate a custom React component. The only requirements are the props, elementId, and location of the React component.

Documentation and Testing

Documentation

Available at readthedocs

Testing

Coming Soon!

Python versions

Currently supporting Python 2 and 3.

Installation

Install via pip

pip install pyxley

metricsgraphics.js Example

An example flask app has been included. It demonstrates how to add a filter and several charts.

Filters & Charts

Each Filter and Chart inherits from the base UIComponent class. Wrappers have been written to provide a clearer interface. An example of a “SelectButton” is provided below. The user only specifies the options, while the type is set by the implementation.

class SelectButton(Filter):    """    """
    def __init__(self, label, items, filter_id, default):
        opts = {            "label": label,            "items": items,            "alias": filter_id,            "default": default
        }        super(SelectButton, self).__init__("SelectButton", opts, None)

UILayout

The UILayout class is designed to integrate the filters and charts with the Flask app. It collects the UIComponents and registers the relevant urls with the app. Within this class, the developer must specify the React layout component, the location of the source jsx file, and the elementid for which the component will be mounted.

Pandas Integration

This library is built with the pandas dataframe in mind. That is, we expect the data to be some sort of structured data that’s easy to filter and easy to plot. Each Javascript charting library has it’s own expected format for the data which makes integration with python challenging. Included in this library are several helper functions that format the data in the way the Javascript libraries are expecting.


转载于:https://my.oschina.net/u/2306127/blog/600298

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值