Exemplo n.º 1
0
def services_product(product):
    pageType = "product"
    qproduct = product
    if qproduct in SERV_DICT.keys():
        database = SERV_DICT[qproduct]
    else:
        database = MALL_DICT[qproduct]
        return render_template('services.html',
                               pageType=pageType,
                               SERV_DICT=SERV_DICT,
                               product=product,
                               MALL_DICT=MALL_DICT)
        pageType = 'areachart'
        category = 'OverAll'
        a = read_database._check('sentiment_redmi')
        import json
        data = json.dumps(a[category])
        data = a[category]
        title = {"text": "This is a test graph "}
        chart = {
            "renderTo": chartID,
            "type": chart_type,
            "height": chart_height,
            "zoomType": 'x'
        }
        series = [{"type": "line", "name": "OverAll Sentiment", "data": data}]
        return render_template('graph.html',
                               pageType=pageType,
                               chart=chart,
                               chartID=chartID,
                               series=series,
                               title=title)
Exemplo n.º 2
0
def area_graph(chartID = "chart_ID" , chart_type = 'line', chart_height = 500):
	pageType = 'areachart'
	category = 'OverAll'
	a = read_database._check('sentiment_redmi')
	import json
	data = json.dumps(a[category])
	data = a[category]
	title = {"text":"This is a test graph "}
	chart = {"renderTo":chartID,"type": chart_type, "height":chart_height,"zoomType":'x'}
	series = [{"type":"line", "name":"OverAll Sentiment" , "data":data}]
	return render_template('graph.html',pageType = pageType, chart = chart, chartID = chartID, series = series, title = title) 
Exemplo n.º 3
0
def product_Overall(product,
                    chartID='chart_ID2',
                    chart_type='line',
                    chart_height=500):
    """
	Controls the coming of the graph on the first search and of course the subsequent ones.
	The product being searched comes via here

	"""
    product_list = product.split('_')
    product_name = product_list[0]
    import createproductdb
    createproductdb.c.execute(
        "SELECT trust FROM products WHERE productname='{}'".format(
            product_name))
    x = createproductdb.c.fetchall()
    trust_value = x[0][0]
    database = DATABASE_DICT[product_name]
    category = product_list[1]
    product_dict = read_database._check(database)
    data = product_dict[category]
    length_of_product = len(CONT_DICT[product_name])
    title = {"text": "Overall Sentiment"}
    chart = {
        "renderTo": chartID,
        "type": chart_type,
        "height": chart_height,
        "zoomType": 'x'
    }
    series = [{"type": "line", "name": "OverAll Sentiment", "data": data}]
    pageType = 'areachart'
    return render_template('graph.html',
                           pageType=pageType,
                           length_of_product=length_of_product,
                           chart=chart,
                           chartID=chartID,
                           title=title,
                           series=series,
                           product_name=product_name,
                           CONT_DICT=CONT_DICT,
                           trust_value=trust_value)