def sonde5(tester=False, tile_id='sp_ex'): start_time = time.time() data = executeScriptToGetData() meta = dict(big_value_color=BACKGROUND_TAB[random.randrange(0, 3)], fading_background=random.choice([False, True])) tipboardAnswer = sendUpdateByApi(tileId=tile_id, data=data, tileTemplate='simple_percentage', tester=tester, meta=meta) end(title=f'sensors5 -> {tile_id}', startTime=start_time, tipboardAnswer=tipboardAnswer, tileId=tile_id)
def sonde12(tester=None, tile_id='normjs_ex'): start_time = time.time() data = updateChartJS(colorTabIndataset=False) tipboardAnswer = sendUpdateByApi(tileTemplate='norm_chart', tileId=tile_id, data=data, tester=tester) end(title=f'sensors12 -> {tile_id}', startTime=start_time, tipboardAnswer=tipboardAnswer, tileId=tile_id)
def sonde22(tester=None, tile_id='custom_ex'): start_time = time.time() data = {'text': returnHttPageExemple()} tipboardAnswer = sendUpdateByApi(data=data, tileTemplate='custom', tileId=tile_id, tester=tester) end(title=f'sensors custom tile -> {tile_id}', startTime=start_time, tipboardAnswer=tipboardAnswer, tileId=tile_id)
def sonde4(tester=None, tile_id='cfjs_ex'): start_time = time.time() data = updateChartJS() tipboardAnswer = sendUpdateByApi(data=data, tileTemplate='cumulative_flow', tileId=tile_id, tester=tester) end(title=f'sensors4 -> {tile_id}', startTime=start_time, tipboardAnswer=tipboardAnswer, tileId=tile_id)
def sonde14(tester=None, tile_id='radar_ex'): start_time = time.time() data = updateChartJS(nbrLabel=5, data=None) index = 0 for dataset in data['datasets']: # TODO: ADD THIS TO .JS not in sensors... for simplicity dataset['pointBorderColor'] = COLOR_TAB[index] dataset['pointBackgroundColor'] = 'rgba(255, 255, 255, 0.5)' dataset['fill'] = True index = index + 1 tipboardAnswer = sendUpdateByApi(data=data, tileTemplate='radar_chart', tileId=tile_id, tester=tester) end(title=f'sensors14 -> {tile_id}', startTime=start_time, tipboardAnswer=tipboardAnswer, tileId=tile_id)
def sonde21(tester=None, tile_id='iframe_ex'): start_time = time.time() data = executeScriptToGetData() answer = sendUpdateByApi(tileId=tile_id, data=data, tileTemplate='iframe', tester=tester) end(title=f'sensor21 -> -> {tile_id}', startTime=start_time, tipboardAnswer=answer, tileId=tile_id)
def sonde17(tester=None, tile_id='half_doughnut_ex'): start_time = time.time() data = updateChartJS(nbrDataset=random.randrange(1, 3), colorTabIndataset=True) tipboardAnswer = sendUpdateByApi(data=data, tileTemplate='half_doughnut_chart', tileId=tile_id, tester=tester) end(title=f'sensors17 -> {tile_id}', startTime=start_time, tipboardAnswer=tipboardAnswer, tileId=tile_id)
def sonde3(tester=None, tile_id='line_chartjs_ex'): TILE_TEMPLATE = 'line_chart' start_time = time.time() data = updateChartJS(nbrLabel=50, nbrDataset=2) tipboardAnswer = sendUpdateByApi(data=data, tileTemplate=TILE_TEMPLATE, tileId=tile_id, tester=tester) end(title=f'sensors3 -> {tile_id}', startTime=start_time, tipboardAnswer=tipboardAnswer, tileId=tile_id)
def sonde15(tester=None, tile_id='polararea_ex'): start_time = time.time() data = updateChartJS(nbrDataset=1, colorTabIndataset=True) meta = {"scale": {"ticks": {"display": False}}} answer = sendUpdateByApi(data=data, tileTemplate='polararea_chart', tileId=tile_id, meta=meta, tester=tester) end(title=f'sensor15 -> -> {tile_id}', startTime=start_time, tipboardAnswer=answer, tileId=tile_id)
def sonde19(tester=None, tile_id='lgauge_ex'): start_time = time.time() data = updateChartJS(nbrDataset=3, nbrLabel=3, colorTabIndataset=False) nbrDataset = 3 data = dict() data['datasets'] = list() offset = 9 # offset start at the end of width of center axis for idx in range(nbrDataset): offset = offset + 11 data['datasets'].append(dict(label=f'Serie {idx}', backgroundColor=COLOR_TAB[idx], data=[random.randrange(100, 500)], offset=offset, width=10)) answer = sendUpdateByApi(data=data, tileTemplate='linear_gauge_chart', tileId=tile_id, tester=tester) end(title=f'sensor19 -> -> {tile_id}', startTime=start_time, tipboardAnswer=answer, tileId=tile_id)
def sonde7(tester=None, tile_id='barjs_ex', isHorizontal=False): TILE_TEMPLATE = 'bar_chart' if isHorizontal else 'vbar_chart' start_time = time.time() data = updateChartJS(nbrDataset=random.randrange(5, 9), nbrLabel=random.randrange(4, 6), colorTabIndataset=False) meta = updateMeta() tipboardAnswer = sendUpdateByApi(data=data, tileTemplate=TILE_TEMPLATE, tileId=tile_id, tester=tester, meta=meta) end(title=f'sensors7 -> {tile_id}', startTime=start_time, tipboardAnswer=tipboardAnswer, tileId=tile_id)
def sonde18(tester=None, tile_id='gauge_ex'): start_time = time.time() data = { 'title': {'display': True, 'text': 'Gauge Demo'}, 'datasets': [ { 'borderWidth': 0, 'gaugeData': { 'value': 36, 'valueColor': COLOR_TAB[5] }, 'gaugeLimits': [-10, 0, 8, 26, 31, 55], 'backgroundColor': [COLOR_TAB[0], COLOR_TAB[8], COLOR_TAB[1], COLOR_TAB[4], COLOR_TAB[5]], } ] } meta = {'labelFormat': '°'} tipboardAnswer = sendUpdateByApi(data=data, tileTemplate='gauge_chart', tileId=tile_id, tester=tester, meta=meta) end(title=f'sensors gauge_chart -> {tile_id}', startTime=start_time, tipboardAnswer=tipboardAnswer, tileId=tile_id)
def sonde6(tester=False, tile_id='listing_ex'): start_time = time.time() data = executeScriptToGetData() tipboardAnswer = sendUpdateByApi(data=data, tileTemplate='listing', tileId=tile_id, tester=tester) end(title=f'sensors6 -> {tile_id}', startTime=start_time, tipboardAnswer=tipboardAnswer, tileId=tile_id)
def sonde2(tester=None, tile_id='pie_chartjs_ex'): start_time = time.time() data = updateChartJS(nbrDataset=1, colorTabIndataset=True) tipboardAnswer = sendUpdateByApi(data=data, tileTemplate='pie_chart', tileId=tile_id, tester=tester) end(title=f'sensors2 -> {tile_id}', startTime=start_time, tipboardAnswer=tipboardAnswer, tileId=tile_id)