2D Canvas Circles

View this example full screen.

JavaScript of 2D Canvas Circles

var g_oTownships = {};
g_oTownships['HuKou'] = {
    center: new zhupiter.CoStr.Point2D(152.0909703111111, 37.72328593151204),
    population: 21
};
g_oTownships['FuGang'] = {
    center: new zhupiter.CoStr.Point2D(265.0909703111111, -66.27671406848796),
    population: 9
};
g_oTownships['YangMei'] = {
    center: new zhupiter.CoStr.Point2D(470.0909703111111, 13.723285931512038),
    population: 36
};

function initialize()
{
    var oMapOptions = {
        coStrType: zhupiter.CoStr.CoStrType.CANVAS2D,
        center: new zhupiter.CoStr.Point2D(214.0909703111111, 109.72328593151204),
        zoom: 12
    };
    var oCoStrMap = new zhupiter.CoStr.Map(document.getElementById('map_canvas'), oMapOptions);

    var oCircle;
    for ( var sName in g_oTownships ) {
        var oCircleOptions = {
            coStrMap: oCoStrMap,
            strokeWeight: 2,
            strokeColor: '#ef1568',
            strokeOpacity: 0.8,
            fillColor: '#61ed04',
            fillOpacity: 0.3,
            center: g_oTownships[sName].center,
            radius: g_oTownships[sName].population
        };
        var oCircle = new zhupiter.CoStr.Circle(oCircleOptions);
    }
}

zhupiter.CoStr.event.addDomListener(window, 'load', initialize);

JavaScript + HTML of 2D Canvas Circles

<!DOCTYPE html>
<html>
    <head>
        <meta name='viewport' content='initial-scale=1.0, user-scalable=no'>
        <meta charset='utf-8'>
        <title>2D Canvas Circles</title>
        <style>
        html, body, #map_canvas {
        height: 100%;
        margin: 0px;
        padding: 0px
        }
        </style>
        <script src='http://costr.zhupiter.com/js/'></script>
        <script>
var g_oTownships = {};
g_oTownships['HuKou'] = {
    center: new zhupiter.CoStr.Point2D(152.0909703111111, 37.72328593151204),
    population: 21
};
g_oTownships['FuGang'] = {
    center: new zhupiter.CoStr.Point2D(265.0909703111111, -66.27671406848796),
    population: 9
};
g_oTownships['YangMei'] = {
    center: new zhupiter.CoStr.Point2D(470.0909703111111, 13.723285931512038),
    population: 36
};

function initialize()
{
    var oMapOptions = {
        coStrType: zhupiter.CoStr.CoStrType.CANVAS2D,
        center: new zhupiter.CoStr.Point2D(214.0909703111111, 109.72328593151204),
        zoom: 12
    };
    var oCoStrMap = new zhupiter.CoStr.Map(document.getElementById('map_canvas'), oMapOptions);

    var oCircle;
    for ( var sName in g_oTownships ) {
        var oCircleOptions = {
            coStrMap: oCoStrMap,
            strokeWeight: 2,
            strokeColor: '#ef1568',
            strokeOpacity: 0.8,
            fillColor: '#61ed04',
            fillOpacity: 0.3,
            center: g_oTownships[sName].center,
            radius: g_oTownships[sName].population
        };
        var oCircle = new zhupiter.CoStr.Circle(oCircleOptions);
    }
}

zhupiter.CoStr.event.addDomListener(window, 'load', initialize);
        </script>
    </head>
    <body>
        <div id='map_canvas'></div>
    </body>
</html>

CoString | Donate bitcoin: 1LX5KC19tXCPK8y72Z6LVoZjoSaCp9P6K