This is a migrated thread and some comments may be shown as answers.

Display XML data in a chart

0 Answers 139 Views
Charts
This is a migrated thread and some comments may be shown as answers.
Maurizio
Top achievements
Rank 1
Maurizio asked on 01 Nov 2011, 01:43 AM
Hi, 

I'm new to Kendo. I'm trying to make a graph from xml data.
This is a sample of the xml file I have:
    <SustainabilityObservationSummaryData>
        <DateTime>1318204800</DateTime>
        <Value>11.5714283</Value>
    </SustainabilityObservationSummaryData>
    <SustainabilityObservationSummaryData>
        <DateTime>1318208400</DateTime>
        <Value>10.8461542</Value>
    </SustainabilityObservationSummaryData>
</ArrayOfSustainabilityObservationSummaryData>
And this is the js I wrote:
function createChart() {
    $("#chart_wrapper").kendoChart({
        theme: $(document).data("kendoSkin") || "kendo",
        dataSource: {
            transport: {
                read: {
                    url: "data.json",
                    dataType: "json"
                }
            }
        },
        title: {
            text: "Spain electricity production (GWh)"
        },
        legend: {
            position: "top"
        },
        seriesDefaults: {
            type: "line"
        },
        series:
        [{
            field: "DateTime",
            name: "Date and Time"
        },
        {
            field: "Value",
            name: "Value"
        }
        ],
        categoryAxis: {
            field: "DateTime",
            labels: {
                rotation: -90
            }
        },
        valueAxis: {
            labels: {
                format: "{0:N0}"
            },
            majorUnit: 5
        },
        tooltip: {
            visible: true,
            format: "{0:N0}"
        }
    });
}
 
$(document).ready(function() {
    createChart();
 
    $(document).bind("kendo:skinChange", function(e) {
        createChart();
    });
});

I get this error from Firebug: f is undefined

What's the problem?

Thanks.

No answers yet. Maybe you can help?

Tags
Charts
Asked by
Maurizio
Top achievements
Rank 1
Share this question
or