Skip to content

Help with data from xml #989

Closed
thecatz opened this Issue Mar 11, 2013 · 1 comment

2 participants

@thecatz
thecatz commented Mar 11, 2013

Hello,
it's my forst time with flot :)

and i'm trying yo populate my chart with datas from xml, but i've no chart. I've read the faq that the data must be int. can someone tel me what going wrong with my code?

in console.log i've this

[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
[360, 328, 296, 119, 105, 94, 135, 85, 77, 92]

and this my try

$(function() {

    $.ajax({
                type: "GET",
                url: "graphmin.xml",
                dataType: "xml",
                success: function (xml) {
                    var names = [];
                    var values = [];
                    var items=[];
                        $(xml).find("Row").each(function () {
                            items.push({
                                name: $(this).attr("Dim1"),
                                value: $(this).attr("Metric1")
                            });
                            
                        });
                   
                        $.each(items, function (key, value) {
                            names.push(parseInt(value.name));
                            values.push(parseInt(value.value));
                        });

        $.plot("#placeholder", [names,values]);
        console.log(names);
        console.log(values);

        

        }
        
        })
        
        });

Thx for any help :)

@dnschnur
Flot member

The issue tracker is for confirmed bugs and feature suggestions only; please post usage questions to the forums.

@dnschnur dnschnur closed this Mar 11, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.