當前位置: 首頁>>代碼示例>>Python>>正文


Python HTML.script方法代碼示例

本文整理匯總了Python中html.HTML.script方法的典型用法代碼示例。如果您正苦於以下問題:Python HTML.script方法的具體用法?Python HTML.script怎麽用?Python HTML.script使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在html.HTML的用法示例。


在下文中一共展示了HTML.script方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: Chart

# 需要導入模塊: from html import HTML [as 別名]
# 或者: from html.HTML import script [as 別名]
class Chart(object):
    """
    Create and modify a chart.

    Parameters
    ----------

    name : str

        The name of the chart. This will be the id of the div that holds the chart. Therefore no two charts in the
        same document should have the same name.

    local_jquery : str

        Path to a local version of jquery. If not provided, one hosted on a CDN is used.

        **Default:** None

    local_requirejs : str

        Path to a local version of requirejs. If not provided, one hosted on a CDN is used.

        **Default:** None

    local_d3_js : str

        Path to a local version of d3js. If not provided, one hosted on a CDN is used.

        **Default:** None

    local_c3_js : str

        Path to a local version of c3js. If not provided, one hosted on a CDN is used.

        **Default:** None

    local_c3_css : str

        Path to a local version of c3's css. If not provided, one hosted on a CDN is used.

        **Default:** None

    Attributes
    ----------

    axes : c3py.axes.Axes

    data : c3py.data.Data

    grid : c3py.grid.Grid

    legend : c3py.legend.Legend

    tooltip : c3py.tooltip.Tooltip

    regions : c3py.regions.Regions

    point : c3py.point.Point

    size : c3py.size.Size

    padding : c3py.padding.Padding
    """

    def __init__(self, name, local_jquery=None, local_requirejs=None, local_d3_js=None, local_c3_js=None,
                 local_c3_css=None):

        super(Chart, self).__init__()

        self.chart_html = HTML()

        self.name = name
        self.c3_css_path = local_c3_css or 'https://cdnjs.cloudflare.com/ajax/libs/c3/0.4.10/c3.min.css'
        self.jquery_path = local_jquery or 'http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js'
        self.requirejs_path = local_requirejs or \
            'https://cdnjs.cloudflare.com/ajax/libs/require.js/2.1.17/require.min.js'
        self.d3_js_path = local_d3_js or 'http://d3js.org/d3.v3.min'
        self.c3_js_path = local_c3_js or 'https://cdnjs.cloudflare.com/ajax/libs/c3/0.4.10/c3.min'

        self.chart_html.div('', id=self.name)
        self.chart_html.link('', href=self.c3_css_path, rel='stylesheet', type='text/css')
        self.chart_html.script('', src=self.jquery_path)
        self.chart_html.script('', src=self.requirejs_path)

        self.requirejs_config = {
            'paths': {
                'c3': self.c3_js_path,
                'd3': self.d3_js_path,
            }
        }

        self.axes = Axes()
        self.data = Data(self.axes)
        self.grid = Grid(self.axes)
        self.legend = Legend()
        self.tooltip = Tooltip()
        self.regions = Regions(self.axes)
        self.point = Point()
        self.size = Size()
        self.padding = Padding()
#.........這裏部分代碼省略.........
開發者ID:harshil-shah,項目名稱:c3py,代碼行數:103,代碼來源:chart.py


注:本文中的html.HTML.script方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。