コード例 #1
0
ファイル: plotly.py プロジェクト: epykure/epyk-engine
import epyk as pk

# Test module to get test data
from epyk.mocks import urls as data_urls
from epyk.mocks import randoms

# Create a basic report object
page = pk.Page()
page.headers.dev()

page.body.set_background()

data_series = randoms.getSeries(5, 30)

z1 = [[[8.83, 8.89, 8.81, 8.87, 8.9,
        8.87], [8.89, 8.94, 8.85, 8.94, 8.96, 8.92],
       [8.84, 8.9, 8.82, 8.92, 8.93,
        8.91], [8.79, 8.85, 8.79, 8.9, 8.94, 8.92],
       [8.79, 8.88, 8.81, 8.9, 8.95,
        8.92], [8.8, 8.82, 8.78, 8.91, 8.94, 8.92],
       [8.75, 8.78, 8.77, 8.91, 8.95,
        8.92], [8.8, 8.8, 8.77, 8.91, 8.95, 8.94],
       [8.74, 8.81, 8.76, 8.93, 8.98,
        8.99], [8.89, 8.99, 8.92, 9.1, 9.13, 9.11],
       [8.97, 8.97, 8.91, 9.09, 9.11, 9.11],
       [9.04, 9.08, 9.05, 9.25, 9.28, 9.27], [9, 9.01, 9, 9.2, 9.23, 9.2],
       [8.99, 8.99, 8.98, 9.18, 9.2, 9.19],
       [8.93, 8.97, 8.97, 9.18, 9.2, 9.18]]]

# url_data = r'https://raw.githubusercontent.com/plotly/datasets/master/polar_dataset.csv'
# data_line_3d = r'https://raw.githubusercontent.com/plotly/datasets/master/3d-line1.csv'
コード例 #2
0
ファイル: c3.py プロジェクト: epykure/epyk-engine
import epyk as pk

# Test module to get test data
from epyk.mocks import urls as data_urls
from epyk.mocks import randoms

# Create a basic report object
page = pk.Page()
page.headers.dev()  # Change the Epyk logo
page.body.set_background()

data = randoms.getSeries(5, 40)

data_rest = page.py.requests.csv(data_urls.PLOTLY_APPLE_PRICES)

ts = page.ui.charts.c3.timeseries(data_rest,
                                  y_columns=['AAPL.Open'],
                                  x_axis="Date")

g = page.ui.charts.c3.gauge(60)
p = page.ui.charts.c3.pie(data, y_columns=[1], x_axis='g')

d = page.ui.charts.c3.donut(data, y_columns=[1], x_axis='g')
s = page.ui.charts.c3.scatter(data, y_columns=list(range(4)), x_axis='x')

bt = page.ui.button("Click").click([s.js.transform('bar'), s.d3])

#stanford = page.ui.charts.c3.stanford(data, y_columns=list(range(4)), x_axis='x', epoch_col=0)

spline = page.ui.charts.c3.spline(data, y_columns=list(range(4)), x_axis='x')
step = page.ui.charts.c3.step(data, y_columns=list(range(4)), x_axis='x')
コード例 #3
0
    })])
page.ui.button("Stop worker").click(
    [w.postMessage({
        'cmd': 'stop',
        'msg': 'Bye'
    })])

t1 = page.ui.title("Display dynamic text")
t1.style.css.margin_top = 10

input = page.ui.inputs.left(placeholder="put you name and click Hi")
page.ui.button("Hi").click(
    [w.postMessage(pk.js_datamap([(input, 'msg')], {'cmd': 'start'}))])
w.on('message', [div.build(w.message)])

series = randoms.getSeries(4, 100)

page.ui.title("Histogram")
hist = page.ui.charts.plotly.histogram(series, y_columns=[1, 2, 3])

w2 = page.js.worker()
w2.connect(content='''
self.addEventListener('message', function(e) {
  var data = e.data; console.log(data);
  switch (data.cmd) {
    case 'add':
      self.postMessage('Result: ' + (data.value1 + data.value2 + data.value3)); break;
    case 'mult':
      self.postMessage('Result: ' + (data.value1 * data.value2 * data.value3)); break;
    case 'stop':
      self.postMessage('WORKER STOPPED: ' + data.msg + '. (buttons will no longer work)');
コード例 #4
0
import epyk as pk


# Test module to get test data
from epyk.mocks import urls as data_urls
from epyk.mocks import randoms


# Create a basic report object
page = pk.Page()
page.headers.dev() # Change the Epyk logo
page.body.set_background()

# Input data
data = randoms.getSeries(5, 30)
data_rest = page.py.requests.csv(data_urls.PLOTLY_APPLE_PRICES)

ts = page.ui.charts.chartJs.timeseries(data_rest, y_columns=['AAPL.Open'], x_axis="Date")

yaxis = ts.options.scales.add_y_axis()
yaxis.gridLines.display = True
yaxis.gridLines.color = 'red'
yaxis.gridLines.zeroLineWidth = 1
yaxis.gridLines.zeroLineColor = 'red'
yaxis.gridLines.drawBorder = True
yaxis.ticks.fontColor = 'red'
yaxis.ticks.beginAtZero = True
yaxis.add_label('Y Axis', color='white')

xaxis = ts.options.scales.x_axes()
コード例 #5
0
ファイル: plotly_surface.py プロジェクト: epykure/epyk-engine
import epyk as pk

# Test module to get test data
from epyk.mocks import randoms

page = pk.Page()
page.headers.dev()

data_series = randoms.getSeries(5, 30)

sur = page.ui.charts.plotly.surface(data_series,
                                    y_columns=[1],
                                    x_axis='x',
                                    z_axis=2)