# unicode

View this example in SVG

How to download and try this example

    Usage: pl -png unicode.htm -font Cyberbit
    or
    pl -svgz unicode.htm -font "Bitstream Cyberbit"

    This example demonstrates rendering of Chinese characters.
    The Chinese characters are UTF-8 encoded herein (I got the translations
    from babelfish and don't know Chinese, so hopefully they are
    not complete nonsense).

    Requirements:
     - Bitstream Cyberbit (freely downloadable) or some other unicode font
     - To create PNG or JPEG, you need to build ploticus with FreeType2 support
     - For SVG, your browser (or viewer app) needs access to the unicode font

    See also the fonts man page

    //index-headings: unicode font, xml_encoding, clustered bars, categories

    // this is used only when producing SVG..
    #proc settings
    xml_encoding: utf-8

    // specify the data.. field 1 is english, field 2 is utf-8 unicode, fields 3 - 5 are values
    #proc getdata
    data:
    chicken	鸡	478	204	184
    beef	牛肉	537	258	202
    pork	猪肉	274	189	148
    lamb	羊羔	147	176	108

    // set up the plotting area
    #proc areadef
    // "Quantities shipped per region"
    title: 数量运送了每区域
    titledetails: align=C size=15
    rectangle: 1 1 4 2.5
    xcategories: datafield=2
    yrange: 0 800
    xaxis.stubs: usecategories
    yaxis.stubs: inc 100
    // "kilograms"
    yaxis.label: 公斤
    yaxis.labeldistance: 0.4

    // do the red bars..
    #proc bars
    locfield: 2
    lenfield: 3
    barwidth: 0.1
    cluster: 1 / 2
    color: red
    // "Northeast" (?)
    legendlabel: 东北

    // do the blue bars..
    #proc bars
    locfield: 2
    lenfield: 4
    barwidth: 0.1
    cluster: 2 / 2
    color: blue
    // "West"
    legendlabel:  西部

    // render the legend using labels specified above..
    #proc legend
    location: max-0.2 max-0.2

    // add a disclaimer :>
    #proc annotate
    location: min 0.5
    textdetails: size=8 align=L
    // "I am sorry if these Chinese translations do not make sense.. they were done by a computer!"
    text:
    我抱歉如果这些中国翻译没有道理。
    他们由计算机做了!