Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3612516
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T22:00:32+00:00 2026-05-18T22:00:32+00:00

Has anyone already used Flot in Android? I’ve been reading this http://rapidandroid.org/wiki/Graphing and i’ve

  • 0

Has anyone already used Flot in Android?

I’ve been reading this http://rapidandroid.org/wiki/Graphing and i’ve re-used a code that i had that is working on a web site.

The problem is that the graphic doesn’t render.

Something like this:

————– JAVASCRIPT THAT GETS THE DATA ——————–

    if ($('#newsStatsCheckbox').is(':checked')) {

        $.ajax( {
            url : mobileClippingStatistics.baseUrl
                    + "countNews.json?aggregation="
                    + $("#aggregation").val() + "&start="
                    + $("#start").val() + "&end=" + $("#end").val(),
            type : "GET",
            dataType : "json",
            success : mobileClippingStatistics.addToGraphic,
            error : function(xhr, ajaxOptions, thrownError) {
                console.error("News hits data is not available...");
                console.error(xhr.status);
                console.error(thrownError);
                alert("News hits data is not available...");
            }
        });

    }

————- OTHER METHODS ———-

          addToGraphic : function(jsonData) {
    // To keep the colors the same  

    if (typeof jsonData == 'string') {
        var splitData = jsonData.split(" ");

        for ( var i = 0; i < splitData.length - 1; i++) {
            var json = eval('(' + splitData[i] + ')');

            json.color = mobileClippingStatistics.plotDataColor;

            mobileClippingStatistics.plotData.push(json);
            mobileClippingStatistics.plotDataBackup.push(json);

            var div = $("<div style='padding-right:10px; position:relative; float:left;' />");

            var label = $("<label/>");
            label
                    .html(mobileClippingStatistics.plotData[mobileClippingStatistics.plotData.length - 1].label);

            var check = $('');
            check.attr('id', "checkbox"
                    + mobileClippingStatistics.plotDataColor);

            div.append(label);
            div.append('<input id="checkbox'+mobileClippingStatistics.plotDataColor+'" type="checkbox" checked="checked" onchange="mobileClippingStatistics.refreshGraphic()" />');

            $("#plotOptions").append(div);

            mobileClippingStatistics.plotDataColor++;

        }

    }

    else {
        jsonData.color = mobileClippingStatistics.plotDataColor;
        mobileClippingStatistics.plotData.push(jsonData);
        mobileClippingStatistics.plotDataBackup.push(jsonData);

        div = $("<div style='padding-right:10px; position:relative; float:left;' />");

        var label = $("<label/>");
        label
                .html(mobileClippingStatistics.plotData[mobileClippingStatistics.plotData.length - 1].label);

        check = $('<input type="checkbox" checked="checked" onchange="mobileClippingStatistics.refreshGraphic()" style="padding-right:10px; />');
        check.attr('id', "checkbox"
                + mobileClippingStatistics.plotDataColor);

        div.append(label);
        div.append('<input id="checkbox'+mobileClippingStatistics.plotDataColor+'" type="checkbox" checked="checked" onchange="mobileClippingStatistics.refreshGraphic()" />');

        $("#plotOptions").append(div);

        mobileClippingStatistics.plotDataColor++;

    }

    mobileClippingStatistics.plotGraphic();

},

plotGraphic : function() {

    // Plot graphic
    var plot = $.plot($("#plot"), mobileClippingStatistics.plotData,
            mobileClippingStatistics.options);

    var overview = $.plot($("#plotOverview"),
            mobileClippingStatistics.plotData, {
                series : {
                    lines : {
                        show : true,
                        lineWidth : 1
                    },
                    shadowSize : 0
                },
                xaxis : {
                    ticks : [],
                    mode : "time"
                },
                yaxis : {
                    ticks : [],
                    autoscaleMargin : 0.1
                },
                selection : {
                    mode : "x"
                },
                legend : {
                    show : false
                }

            });

    mobileClippingStatistics.showPlots();

    $("#plot").bind(
            "plotselected",
            function(event, ranges) {
                // do the zooming

                plot = $.plot($("#plot"),
                        mobileClippingStatistics.plotData, $.extend(true,
                                {}, mobileClippingStatistics.options, {
                                    xaxis : {
                                        min : ranges.xaxis.from,
                                        max : ranges.xaxis.to
                                    }
                                }));

                // don't fire event on the overview to prevent eternal loop
                overview.setSelection(ranges, true);
            });

    $("#plotOverview").bind(
            "plotselected",
            function(event, ranges) {
                // plot.setSelection(ranges);
                $("#plot").html("");
                $.plot($("#plot"), mobileClippingStatistics.plotData, $
                        .extend(true, {}, mobileClippingStatistics.options,
                                {
                                    xaxis : {
                                        min : ranges.xaxis.from,
                                        max : ranges.xaxis.to
                                    }
                                }));
            });

},

defineOptions : function() {
    mobileClippingStatistics.options = {
        lines : {
            show : true
        },
        points : {
            show : true
        },
        xaxis : {
            mode : "time"
        },
        yaxis : {
            min : 0
        },

        grid : {
            markings : mobileClippingStatistics.weekendAreas
        }

    };

},

The graphic doesn’t render, although the divs/checkboxs with the data name render.

Ideias?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T22:00:33+00:00Added an answer on May 18, 2026 at 10:00 pm

    Got this to work.

    First plot the graphic without data.

    Then get the data, and replot it.

    Some other fixes/modifications were done so I isn’t easy to post a single modification that put this to work.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is going probably be a general question regarding checksum used for error detection.
So firefox has a nifty mechanism which will try to autocomplete values in fields
The USPS provides a C library and a Java wrapper for generating their new
I'm looking for something that can interpret a string in php and perform simple
Summary I currently have a NAnt build script that performs a vssget on either
I'm working in a Java-oriented shop and we're starting to adapt our products to
I have read that HttpURLConnection supports persistent connections, so that a connection can be
Is there an easy way to dynamically discover all the XAMLs files within all
I have a great concern in deploying the TinyMCE editor on a website. Looking
Twitter's Streaming API seems to provide a way to receive realtime tweets without constantly

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.