require.js + dojo 1.7 (branch)

Can we map and load dojo modules with an AMD loader?

by Himanshu Joshi

HTML

<script src="//cdnjs.cloudflare.com/ajax/libs/require.js/2.0.6/require.min.js">
</script>

<div id="container" style="width: 500px; height: 400px; margin: 0 auto"></div>

JavaScript

require({
    paths: {
        hchart: "http://code.highcharts.com/highcharts",
        'hchart-more': "http://code.highcharts.com/highcharts-more",
        'hchart-export': "http://code.highcharts.com/modules/exporting",
        jquery: "//cdnjs.cloudflare.com/ajax/libs/jquery/1.8.2/jquery.min"
    }
}, ['jquery', 'hchart','hchart-more','hchart-export'], function($, hc) {
    window.chart = new Highcharts.Chart({

        chart: {
            renderTo: 'container',
            polar: true,
            type: 'line'
        },

        title: {
            text: 'Budget vs spending',
            x: -80
        },

        pane: {
            size: '80%'
        },

        xAxis: {
            categories: ['Sales', 'Marketing', 'Development', 'Customer Support',
                                    'Information Technology', 'Administration'],
            tickmarkPlacement: 'on',
            lineWidth: 0
        },

        yAxis: {
            gridLineInterpolation: 'polygon',
            lineWidth: 0,
            min: 0
        },

        tooltip: {
            shared: true,
            valuePrefix: '$'
        },

        legend: {
            align: 'right',
            verticalAlign: 'top',
            y: 100,
            layout: 'vertical'
        },

        series: [{
            name: 'Allocated Budget',
            data: [43000, 19000, 60000, 35000, 17000, 10000],
            pointPlacement: 'on'},
        {
            name: 'Actual Spending',
            data: [50000, 39000, 42000, 31000, 26000, 14000],
            pointPlacement: 'on'}]

    }, function(chart) {
        chart.isDirty = true;
        chart.redraw();

    });

    console.log(chart);
});