Beispiel #1
0
def effectscatterByInd(title, datas, size=None):

    # import random
    # data = [random.randint(0, 100) for _ in range(80)]
    range_color = ['#313695', '#4575b4', '#74add1', '#abd9e9', '#e0f3f8', '#ffffbf',
                   '#fee090', '#fdae61', '#f46d43', '#d73027', '#a50026']

    if size is None:
        scatter = EffectScatter(
                                title,
                                width=320,
                                height=180,
                                title_pos="center",
                                # background_color='#f0f0f0',
        )
    else:
        scatter = EffectScatter(
                                title,
                                width=size['width'],
                                height=size['height'],
                                title_pos="center",
                                # background_color='#f0f0f0',
        )

    for _val in datas:

        _effect_scale = 3.
        _symbol_size = 3.
        if "high" in _val:
            _effect_scale += 1.5
            _symbol_size += 8.
        elif "norm" in _val:
            _effect_scale += 1.
            _symbol_size += 5.
        else:
            logging.log(logging.WARN, u">>> effectscatterByInd: %s" % datas[_val]['label'])

        scatter.add("", datas[_val]['x'], datas[_val]['y'],
                    is_visualmap=False,
                    visual_range_color=range_color,
                    effect_scale=_effect_scale,
                    symbol_size=_symbol_size,
                    )

    scatter.options['toolbox']['show'] = False
    scatter.options['xAxis'][0]['show'] = False
    scatter.options['yAxis'][0]['show'] = False
    return scatter.render_embed()
Beispiel #2
0
def effectscatter(title, datas, size=None):

    # import random
    # data = [random.randint(0, 100) for _ in range(80)]
    range_color = ['#313695', '#4575b4', '#74add1', '#abd9e9', '#e0f3f8', '#ffffbf',
                   '#fee090', '#fdae61', '#f46d43', '#d73027', '#a50026']

    if size is None:
        scatter = EffectScatter(
                                title,
                                width=320,
                                height=180,
                                title_pos="center",
                                background_color='#f0f0f0',
                          )
    else:
        scatter = EffectScatter(
                                title,
                                width=size['width'],
                                height=size['height'],
                                title_pos="center",
                                background_color='#f0f0f0',
                          )
    _scale = 1.5
    for _data in datas:
        if "v" not in _data:
            scatter.add("", _data['x'], _data['y'],
                        is_visualmap=False,
                        visual_range_color=range_color,
                        mark_line=['average'],
                        mark_point=['max', 'min'],
                        effect_scale=_scale,
                        symbol_size=5,
                        )
            _scale += 1.
        else:
            scatter.add("", _data['x'], _data['y'],
                        is_visualmap=False,
                        # visual_range_color=range_color,
                        mark_line=['average'],
                        mark_point=['max', 'min'],
                        effect_scale=1.5 + float(_data['v'])/40.,
                        symbol_size=3+_data['v']/3,
                        )

    scatter.options['toolbox']['show'] = False
    return scatter.render_embed()