def function_to_graph(x_axis, y_axis, title):
    chart = pieChart(name=title, color_category='category20c', height=450, width=450)
    xdata = x_axis
    ydata = y_axis
    extra_serie = {"tooltip": {"y_start": "", "y_end": "tweets"}}
    chart.add_serie(y=ydata, x=xdata, extra=extra_serie)
    chart.buildcontent()
    return chart.htmlcontent
示例#2
0
 def test_pieChart(self):
     """Test Pie Chart"""
     type = "pieChart"
     chart = pieChart(name=type, height=400, width=400)
     xdata = ["Orange", "Banana", "Pear", "Kiwi", "Apple", "Strawberry", "Pineapple"]
     ydata = [3, 4, 0, 1, 5, 7, 3]
     chart.add_serie(y=ydata, x=xdata)
     chart.buildhtml()
示例#3
0
 def test_pieChart(self):
     """Test Pie Chart"""
     type = "pieChart"
     chart = pieChart(name=type, color_category='category20c', height=400, width=400)
     xdata = ["Orange", "Banana", "Pear", "Kiwi", "Apple", "Strawberry", "Pineapple"]
     extra_serie = {"tooltip": {"y_start": "", "y_end": " cal"}}
     ydata = [3, 4, 0, 1, 5, 7, 3]
     chart.add_serie(y=ydata, x=xdata, extra=extra_serie)
     chart.buildhtml()
示例#4
0
 def test_pieChart(self):
     """Test Pie Chart"""
     type = "pieChart"
     chart = pieChart(name=type, color_category='category20c', height=400, width=400)
     xdata = ["Orange", "Banana", "Pear", "Kiwi", "Apple", "Strawberry", "Pineapple"]
     color_list = ['orange', 'yellow', '#C5E946', '#95b43f', 'red', '#FF2259', '#F6A641']
     extra_serie = {"tooltip": {"y_start": "", "y_end": " cal"}, "color_list": color_list}
     ydata = [3, 4, 0, 1, 5, 7, 3]
     chart.add_serie(y=ydata, x=xdata, extra=extra_serie)
     chart.buildhtml()
示例#5
0
def get_chart(freq):
    chart_type = 'pieChart'
    chart = pieChart(name=chart_type, color_category='category20c', height=450, width=450)
    extra_serie = {"tooltip": {"y_start": "", "y_end": " %"}}
    xdata,ydata=zip(*freq.items())
    chart.add_serie(y=ydata, x=xdata, extra=extra_serie)
    # text_white="d3.selectAll('#pieChart text').style('fill', 'white');"
    # chart.add_chart_extras(text_white)
    chart.buildcontent()
    return chart.htmlcontent
示例#6
0
文件: graphs.py 项目: diogo149/simbo
def pie_chart(labels, data, label=""):
    chart = nvd3.pieChart(name="",
                          color_category='category20c',
                          height=450, width=450)
    chart.jquery_on_ready = True

    #Add the serie
    extra_serie = {"tooltip": {"y_start": "", "y_end": label}}
    chart.add_serie(y=data, x=labels, extra=extra_serie)
    chart.buildcontent()
    # assuming name is hardcoded to ""
    return js_extract(chart.htmlcontent).replace("# svg", "#importances_graph")
def allcounty(set_2, allpeople, html, county):
    type = 'pieChart'
    chart1 = pieChart(name=type, color_category='category20c', height=1100, width=900)
    set_1 = ["พิการทางสายตา", "พิการทางการได้ยิน", "ทางการเคลื่อนไหวหรือทางร่างกาย", "ทางจิตใจหรือพฤติกรรม", "ทางสติปัญญา", "ทางการเรียนรู้", "ทางออทิสติก", "พิการมากกว่า 1 ประเภท", "ไม่ระบุ"]
    set_2 = set_2
    extra_serie = {"tooltip": {"y_start": "", "y_end": " person"}}
    chart1.add_serie(y=set_2, x=set_1, extra=extra_serie)
    chart1.buildhtml()
    file = codecs.open(html, "w+", "utf-8")
    p_title = "<body background=bg2.jpg><div align=center>จำนวนคนพิการทั้งหมดที่มีบัตรประจำตัวคนพิการจังหวัด"+county+"ทั้งหมดตั้งแต่ปี พ.ศ. 2537 ถึง พ.ศ. 2558 จำนวน "+str(allpeople)+" คน<br>"+" "+"<input type=button onclick=window.location.href='index.html' value=Home></div></body>"
    file.write(p_title)
    file.write("<br>")
    file.write(chart1.htmlcontent)
    file.close()
def piechart(set_, maxx, name, name_type):
    """create a piechart by list"""
    type = 'pieChart'
    chart3 = pieChart(name=type, color_category='category20c', height=1100, width=900)
    set_1 = ["เพศชาย", "เพศหญิง"]
    set_2 = set_
    extra_serie = {"tooltip": {"y_start": "", "y_end": " person"}}
    chart3.add_serie(y=set_2, x=set_1, extra=extra_serie)
    chart3.buildhtml()
    file = codecs.open(name, "w+", "utf-8")
    p_title = "<body background=bg2.jpg><div align=center>จำนวนคนพิการ"+name_type+"แต่ละประเภทที่มีบัตรประจำตัวคนพิการในประเทศไทยทั้งหมดตั้งแต่ปี พ.ศ. 2537 ถึง พ.ศ. 2558 จำนวน "+str(maxx)+" คน<br>"+" "+"<input type=button onclick=window.location.href='index.html' value=Home></div></body>"
    file.write(p_title)
    file.write("<br>")
    file.write(chart3.htmlcontent)
    file.close()
def hello():
    crimes = list(csv.reader(open('noCrimeOutput.txt', 'rb'), delimiter='\t'))

    chart = pieChart(name='pieChart', color_category='category20c', height=800, width=800)
    xdata = []
    ydata = []
    for crime in crimes:
        xdata.append(crime[0])
        ydata.append(crime[1])

    extra_serie = {"tooltip": {"y_start": "", "y_end": " counts"}}
    chart.add_serie(y=ydata, x=xdata, extra=extra_serie)
    chart.buildhtml()

    return chart.htmlcontent
示例#10
0
 def d3js_htmls(self):
     """ visualize data using D3.js(wrapped by python-nvd3)
     """
     global html_lineChart, html_pieChart
     if self.vars_dict.get('LINE_CHART'):
         chart_name = self.vars_dict.get('TABULATE_FILE')
         height = 768
         width = 1366
         line_chart = lineChart(name='[line]'+chart_name,
                                height=height,
                                width=width)
         line_data = self.get_tabulate_data(self.vars_dict.get('LAST_DAYS'))
         # x_data = [each[0].strip() for each in line_data][1:]
         # x_data = map(lambda x: mktime(datetime.strptime(x, '%Y-%m-%d').timetuple()), x_data)
         x_data = list(range(-30, 0))
         name_list = line_data[0][1:]
         y_data_list = []
         for i in range(1, len(line_data[0])):
             y_data_list.append([each[i] for each in line_data[1:]])
         extra_serie = {
             'tooltip': {
                 'y_start': '',
                 'y_end': 'counts'
             }
         }
         for name, y_data in zip(name_list, y_data_list):
             line_chart.add_serie(y=y_data, x=x_data, name=name, extra=extra_serie)
         line_chart.buildhtml()
         html_lineChart = line_chart.htmlcontent
     if self.vars_dict.get('PIE_CHART'):
         rows = self.res_counts
         xdata, ydata = zip(*rows)
         extra_serie = {
             'tooltip': {
                 'y_start': '',
                 'y_end': 'counts'
             }
         }
         chart_name = self.vars_dict.get('FILE_PATH')
         height = 768
         width = 1366
         pie_chart = pieChart(name='[pie]'+chart_name, color_category='category20c', height=height, width=width)
         pie_chart.set_containerheader("\n\n<h2>" + chart_name + "</h2>\n\n")
         pie_chart.add_serie(y=ydata, x=xdata, extra=extra_serie)
         pie_chart.buildhtml()
         html_pieChart = pie_chart.htmlcontent
     return html_lineChart, html_pieChart
示例#11
0
def piechart(set_, maxx, name, name_type):
    """create a piechart by list"""
    type = 'pieChart'
    chart3 = pieChart(name=type, color_category='category20c', height=1100, width=900)
    set_1 = ["กรุงเทพมหานคร", "กาญจนบุรี", "จันทบุรี", "ฉะเชิงเทรา", "ชลบุรี","ชัยนาท", "ตราด", "นครนายก", "นครปฐม", "นนทบุรี", "ปทุมธานี", "ประจวบคีรีขันธ์", "ปราจีนบุรี", "พระนครศรีอยุธยา", "เพชรบุรี", "ระยอง", "ราชบุรี", "ลพบุรี", "สมุทรปราการ", "สมุทรสงคราม", "สมุทรสาคร", "สระแก้ว", "สระบุรี", "สิงห์บุรี", "สุพรรณบุรี", "อ่างทอง", "กาฬสินธุ์", "ขอนแก่น", "ชัยภูมิ",\
             "นครพนม", "นครราชสีมา", "บึงกาฬ", "บุรีรัมย์", "มหาสารคาม", "มุกดาหาร", "ยโสธร", "ร้อยเอ็ด", "เลย", "ศรีสะเกษ", "สกลนคร", "สุรินทร์", "หนองคาย", "หนองบัวลำภู", "อำนาจเจริญ", "อุดรธานี", "อุบลราชธานี", "กระบี่", "ชุมพร", "ตรัง", "นครศรีธรรมราช", "นราธิวาส", "ปัตตานี", "พังงา", "พัทลุง", "ภูเก็ต", "ยะลา", "ระนอง", "สงขลา", "สตูล", "สุราษฎร์ธานี",\
             "กำแพงเพชร", "เชียงราย", "เชียงใหม่", "ตาก", "นครสวรรค์", "น่าน", "พะเยา", "พิจิตร", "พิษณุโลก", "เพชรบูรณ์", "แพร่", "แม่ฮ่องสอน", "ลำปาง", "ลำพูน", "สุโขทัย", "อุตรดิตถ์", "อุทัยธานี"]
    set_2 = set_
    extra_serie = {"tooltip": {"y_start": "", "y_end": " person"}}
    chart3.add_serie(y=set_2, x=set_1, extra=extra_serie)
    chart3.buildhtml()
    file = codecs.open(name, "w+", "utf-8")
    p_title = "<body background=bg2.jpg><div align=center>จำนวนคนพิการ"+name_type+"เพศชายที่มีบัตรประจำตัวคนพิการทุกจังหวัดทั้งหมดตั้งแต่ปี พ.ศ. 2537 ถึง พ.ศ. 2558 จำนวน "+str(maxx)+" คน<br>"+" "+"<input type=button onclick=window.location.href='index.html' value=Home></div></body>"
    file.write(p_title)
    file.write("<br>")
    file.write(chart3.htmlcontent)
    file.close()
示例#12
0
    def graphic_time_activity_day():
        """
        :return:
        """
        output_file = open(_time_activity_day, 'w')
        _num_week = int(this_week()) - 1
        _week = WeekNumber.objects.get(num_week= _num_week)
        _act = Activity()
        _tp_acts = TypeActivity.objects.values('group').distinct()

        # xdata = ["Orange", "Banana", "Pear", "Kiwi", "Apple", "Strawberry", "Pineapple"]
        # ydata = [3, 4, 0, 1, 5, 7, 3]
        xdata = []
        ydata = []
        _time = 0
        for _type_act in _tp_acts:
            _time_week = _act.get_time_activity(_week, _type_act['group'])
            if not _time_week is None and _time_week > 0:
                xdata.append(_type_act['group'])
                ydata.append(float(_time_week))
                _time += float(_time_week)

        type = 'Closed %s - time activity (%s hours weeks)' %(DayL[int(_time/24)-1], str(_time))
        chart = pieChart(name=type, color_category='category20c', height=450, width=450)
        chart.set_containerheader("\n\n<h2>" + type + "</h2>\n\n")

        extra_serie = {"tooltip": {"y_start": "", "y_end": " hs"}}
        chart.add_serie(y=ydata, x=xdata, extra=extra_serie)

        chart.buildhtml()
        output_file.write(chart.htmlcontent)
        output_file.close()
        # data = {
        #     'charttype': charttype,
        #     'chartdata': chartdata,
        # }
        # return render_to_response("graphic.html")
        # new_uri = '%s://%s%s%s' % (
        #         request.is_secure() and 'https' or 'http',
        #         site.domain,
        #         urlquote(request.path),
        #         (request.method == 'GET' and len(request.GET) > 0) and '?%s' % request.GET.urlencode() or ''
        #     ) http://eikke.com/django-domain-redirect-middleware/

        graphic_view(_time_activity_day)
示例#13
0
def generate_sentiment_chart(topics, name):
    chart = pieChart(name=name, color_list=["green", "red"], height=400, width=400)
    xdata = ["Positive sentiment", "Negative sentiment"]
    ydata = []

    total_population = []
    for topic in topics:
        population = retrieve_by_topic(topic, "posts")
        for p in population:
            total_population.append(p)

    pos, neg = get_sentiment_stats(total_population)
    ydata.append(pos)
    ydata.append(neg)

    extra_serie = {"tooltip": {"y_start": "", "y_end": "%"}}
    chart.add_serie(y=ydata, x=xdata, extra=extra_serie)

    str(chart)
    return chart.content
示例#14
0
#Open File for test
output_file = open('test1.html', 'w')

type = "discreteBarChart"
chart = discreteBarChart(name=type, height=400, width=400)
chart.set_containerheader("\n\n<h2>" + type + "</h2>\n\n")
xdata = ["A", "B", "C", "D", "E", "F", "G"]
ydata = [3, 12, -10, 5, 35, -7, 2]

chart.add_serie(y=ydata, x=xdata)
chart.buildhtml()
output_file.write(chart.htmlcontent)
#---------------------------------------

type = "pieChart"
chart = pieChart(name=type, height=400, width=400)
chart.set_containerheader("\n\n<h2>" + type + "</h2>\n\n")
xdata = ["Orange", "Banana", "Pear", "Kiwi", "Apple", "Strawberry", "Pineapple"]
ydata = [3, 4, 0, 1, 5, 7, 3]

chart.add_serie(y=ydata, x=xdata)
chart.buildhtml()
output_file.write(chart.htmlcontent)
#---------------------------------------

type = "multiBarChart"
chart = multiBarChart(name=type, height=350)
chart.set_containerheader("\n\n<h2>" + type + "</h2>\n\n")
nb_element = 10
xdata = range(nb_element)
ydata = [random.randint(1, 10) for i in range(nb_element)]
示例#15
0
    def gender(self,**kwargs):
        """
        Creates gender distribution figures.
       
        Parameters (generated during class initialization)
        ----------
        NVD3 = False.  If true, nvd3 interactive figure output.

        Output
        ------
        Saves figures to specified directories.

        Returns
        -------
        None
        """
        
        NVD3 = kwargs.get('NVD3',False)

        ### Removes those users not having the option to fill in edX registration data.
        trim_data = self.person[(self.person.registered==1) & (self.person.user_id>156633)]

        ### Data
        gdict =  {'f': "$Female$",'m': "$Male$",'o':"$Other$"}
        glist = ['$Female$','$Male$']

        ### Munge and Plot
        gender = trim_data.gender.dropna().apply(lambda x: gdict[x]).value_counts()
        #print gender
        certs = trim_data[trim_data.certified==1]
        if certs.username.count() > self.mincerts:
            certs = certs.gender.dropna().apply(lambda x: gdict[x]).value_counts()
        else:
            certs = pd.Series(index=gender.index)    

        gender = pd.concat([gender,certs],join='inner',axis=1,keys=['$Non-Certified$','$Certified$']) 
        gender = 100.*gender/gender.sum()
        gender = gender.apply(lambda x: np.round(x,1))

        fig = plt.figure(figsize=(12,6))
        ax1 = fig.add_subplot(1,1,1)
        gender.ix[glist,:].plot(ax=ax1,kind='bar',color=[xff.colors['neutral'],xff.colors['institute']],rot=0)

        ### Plot Details
        ax1.set_xticklabels([r'%s' % x for x in glist])
        ax1.set_yticklabels([r'${0}\%$'.format("%.0f" % (y)) for y in ax1.get_yticks()],fontsize=30)
        ax1.legend(loc=2,prop={'size':28},frameon=False)

        ### Generalized Plotting functions
        figsavename = self.figpath+'gender_distribution_'+self.nickname.replace('.','_')
        print figsavename
        xff.texify(fig,ax1,xlabel=None,ylabel='Count',figsavename=figsavename+'.png')

        # ### Output JSON Records
        # gender.name = 'value'
        # gender = gender.reset_index().rename(columns={'index':'label'})
        # gender.dropna().to_json(figsavename+'.json',orient='records')


        #----------------------------------------------------------------
        ### NVD3 Interactive http://nvd3.org/
        if NVD3:
            
            'http://nvd3.org/examples/pie.html'
            

            X = [ x.replace('$','') for x in gender.index ]
            Y1 = gender.ix[glist,'$Non-Certified$'].values
            Y2 = gender.ix[glist,'$Certified$'].values

            #----------------------------------------------------------------
            ### BAR Chart
            from nvd3 import multiBarChart

            ### Output File
            figsavename = self.figpath+'interactive_gender_distribution_'+self.nickname+'.html'
            output_file = open(figsavename, 'w')
            print figsavename

            title = "Gender Distribution: %s" % self._xd.course_id
            charttype = 'multiBarChart'
            chart = multiBarChart(name=charttype, height=350, x_axis_format="", y_axis_format=".1f")
            chart.set_containerheader("\n\n<h2>" + title + "</h2>\n\n")
            nb_element = len(gender.ix[glist,:])
            

            ### Series 1
            extra_serie1 = {"tooltip": {"y_start": "", "y_end": "%"},
                            "color":xff.colors['neutral'],
                            "format":".1f"
                            }
            chart.add_serie(name="Participants", y=Y1, x=X, extra=extra_serie1)
            
            ### Series 2
            extra_serie2 = {"tooltip": {"y_start": "", "y_end": "%"},
                            "color":xff.colors['institute'],
                            "format":".1f"
                            }
            chart.add_serie(name="Certificate Earners", y=Y2, x=X, extra=extra_serie2)
            
            ### Final Output
            chart.buildhtml()
            output_file.write(chart.htmlcontent)

            #---------------------------------------

            #close Html file
            output_file.close()


            #----------------------------------------------------------------
            ### Pie Chart
            from nvd3 import pieChart

            ### Output File
            figsavename = self.figpath+'interactive_gender_piechart_'+self.nickname+'.html'
            output_file = open(figsavename, 'w')
            print figsavename

            title = "Gender Pie Chart: %s" % self._xd.course_id
            charttype = 'multiBarChart'
            chart = pieChart(name=charttype, color_category='category20c', height=400, width=400)
            chart.set_containerheader("\n\n<h2>" + title + "</h2>\n\n")

            extra_serie = {"tooltip": {"y_start": "", "y_end": " certified"}}

            chart.add_serie(y=Y1, x=X, extra=extra_serie)
            
            ### Final Output
            chart.buildhtml()
            output_file.write(chart.htmlcontent)

            #---------------------------------------

            #close Html file
            output_file.close()



        return None
示例#16
0
type = "discreteBarChart"
chart = discreteBarChart(name='my graphname', height=400, width=800, jquery_on_ready=True)
chart.set_containerheader("\n\n<h2>" + type + "</h2>\n\n")
xdata = ["A", "B", "C", "D", "E", "F", "G"]
ydata = [3, 12, -10, 5, 25, -7, 2]

extra_serie = {"tooltip": {"y_start": "", "y_end": " cal"}}
chart.add_serie(y=ydata, x=xdata, extra=extra_serie)

chart.buildcontent()
output_file.write(chart.htmlcontent)
# ---------------------------------------

type = "pie Chart"
chart = pieChart(name=type, color_category='category20c', height=400,
                 width=400, jquery_on_ready=True)
chart.set_containerheader("\n\n<h2>" + type + "</h2>\n\n")

color_list = ['orange', 'yellow', '#C5E946', '#95b43f', 'red', '#FF2259', '#F6A641']
extra_serie = {"tooltip": {"y_start": "", "y_end": " cal"}, "color_list": color_list}
xdata = ["Orange", "Banana", "Pear", "Kiwi", "Apple", "Strawberry", "Pineapple"]
ydata = [3, 4, 2, 1, 5, 7, 3]

chart.add_serie(y=ydata, x=xdata, extra=extra_serie)
chart.buildcontent()
output_file.write(chart.htmlcontent)
# ---------------------------------------

name = "lineChart-different-x-axis"
type = "lineChart"
chart = lineChart(name=name, height=400, width=800, x_is_date=False,
示例#17
0
<html lang="th">
    <head>
        <meta charset="utf-8" />
        <link href="https://cdnjs.cloudflare.com/ajax/libs/nvd3/1.7.0/nv.d3.min.css" rel="stylesheet" />
        <script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.5/d3.min.js"></script>
        <script src="https://cdnjs.cloudflare.com/ajax/libs/nvd3/1.7.0/nv.d3.min.js"></script>
        <title>2014 Annual Survey of State Government Tax Collections</title>
    </head>
    <body>
    <center><h1>2014 Annual Survey of State Government Tax Collections</h1></center>
"""

pattern = {"tooltip": {"y_start": "", "y_end": " Million USD"}}

chart = multiBarChart(width=1024, height=768, x_axis_format=None)
chart1 = pieChart(name="chart1", color_category="category20c", height=800, width=768)

chart1.add_serie(y=total_taxes, x=states, extra={"tooltip": {"y_start": "", "y_end": " %"}})
chart1.buildcontent()

chart.add_serie(name="chart", y=total_taxes, x=states)
chart.buildcontent()

file.write(headhtml)

file.write("<center><h2>All Tax Collections By States</h2></center>")
file.write("<center>")
file.write(chart1.htmlcontent)
file.write("</center>")
file.write("<center><h2>State Government Tax CollectionsTax Collections By Category</h2></center>")
示例#18
0
"""
Examples for Python-nvd3 is a Python wrapper for NVD3 graph library.
NVD3 is an attempt to build re-usable charts and chart components
for d3.js without taking away the power that d3.js gives you.

Project location : https://github.com/areski/python-nvd3
"""

from nvd3 import pieChart


#Open File for test
output_file = open('test_pieChart.html', 'w')

type = "pieChart"
chart = pieChart(name=type, color_category='category20c', height=400, width=400)
chart.set_containerheader("\n\n<h2>" + type + "</h2>\n\n")

extra_serie = {"tooltip": {"y_start": "", "y_end": " cal"}}
xdata = ["Orange", "Banana", "Pear", "Kiwi", "Apple", "Strawberry", "Pineapple"]
ydata = [3, 4, 0, 1, 5, 7, 3]

chart.add_serie(y=ydata, x=xdata, extra=extra_serie)
chart.buildhtml()
output_file.write(chart.htmlcontent)
#---------------------------------------

#close Html file
output_file.close()
from nvd3 import pieChart
%load_ext rpy2.ipython
xs = %R sort(unique(mtcars$cyl))
ys = %R table(mtcars$cyl)
chart = pieChart(name="Cylinders", color_category='category10', height=500, width=400)
chart.add_serie(x=xs.tolist(), y=ys.tolist())
output_file = open('nvd3-3.html', 'w')
chart.buildhtml()
output_file.write(chart.htmlcontent)
output_file.close()
示例#20
0
 
 
chart.buildcontent() # Build HTML content only
output_file.write(chart.htmlcontent)
 
output_file.write("<p>All key word rank: <br>1st: ['service', 'manage', 'manage', 'manage', 'sale'], <br> 2nd: ['custom', 'work', 'work', 'work', 'custom'],<br>3rd: ['manage', 'service', 'service', 'service', 'product'], <br>4th: ['work', 'detail', 'custom', 'provide', 'service'], <br>5th: ['experiment', 'provide', 'experiment', 'response', 'work'],<br>6th: ['time', 'custom', 'require', 'custom', 'time'],<br>7th: ['sale', 'include', 'detail', 'sale', 'companies'],<br>8th: ['provid', 'require', 'provide', 'detail', 'manage'],<br>9th: ['require', 'companies', 'develop', 'develop', 'experiment'],<br>10th: ['detail', 'develop', 'response', 'experiment', 'detail']</p>")
output_file.write("<p>Interestingly the hightest appeared key words from Job titles and Job descriptions are slightly different, we can see that the hottest job key words are: management, work, customer, service, sales, experienced, provider.</p>")
 
 
# ----------------------------Title_11/15 Pie Chart
 
output_file.write('<h3>Closer look at Top 10 Key Words in Job Title</h3>')
output_file.write("<p>Following pie charts provides a closer look at Top 10 Key Words in Job Title</p>")
 
type = "Hottest Key Words in Job Title for 11/15"
chart = pieChart(name=type, color_category='category20c', height=350, width=1000)
#chart.set_containerheader("\n\n<h3>" + type + "</h3>\n\n")
#chart.add_chart_extras("\n\n<p>" + 'Here is the description.' + "<p>\n\n")
#chart.header_css = <link rel="stylesheet" href="styles.css">
extra_serie = {"tooltip": {"y_start": "", "y_end": " %"}}
xdata = ['service', 'manage', 'entry', 'custom', 'sale', 'member', 'food', 'crew', 'nurse', 'assist']
ydata = [0.19763513513513514, 0.13429054054054054, 0.11570945945945946, 0.10557432432432433, 0.10050675675675676, 0.0785472972972973, 0.07263513513513513, 0.07179054054054054, 0.06672297297297297, 0.056587837837837836]
ydata = [ydata[i]*100 for i in range(9)]
chart.add_serie(y=ydata, x=xdata, extra=extra_serie)
 
 
chart.buildcontent() # Build HTML content only
output_file.write(chart.htmlcontent)
 
#----------------------------- Title_11/17 Pie Chart
type = "Hottest Key Words in Job Title for 11/17"