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

  • Home
  • SEARCH
  • 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 5996011
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T00:02:31+00:00 2026-05-23T00:02:31+00:00

The first script is not working, the second is. <script type=text/javascript> var pageHits =

  • 0

The first script is not working, the second is.

<script type="text/javascript">
    var pageHits = [30,60,22,5,60,88,102];
    var rssHits = [33,45,121,23,55,35,77];
    var xAxis = ['Jan 2009', 'Feb 2009', 'Mar 2009', 'Apr 2009', 'May 2009', 'June 2009', 'Jul 2009'];


    jQuery(function() {

        $.jqplot('chartDiv', [pageHits, rssHits], CreateLineChartOptions());

        $('#barChartButton').click(function() {
            $('#chartDiv').html('');
            $.jqplot('chartDiv', [pageHits, rssHits], CreateBarChartOptions());
        });
        $('#lineChartButton').click(function() {
            $('#chartDiv').html('');
            $.jqplot('chartDiv', [pageHits, rssHits], CreateLineChartOptions());
        });
        $('#stackedBarChartButton').click(function() {
            $('#chartDiv').html('');
            $.jqplot('chartDiv', [pageHits, rssHits], CreateStackedBarChartOptions());
        });
    });

    function CreateLineChartOptions()
    {
        var optionsObj = {
            title: 'Blog Statistics',
            axes: {
                 xaxis: {
                    renderer: $.jqplot.CategoryAxisRenderer,
                    ticks: xAxis
                }
            },
            series: [{label:'Page Hits'}, {label: 'RSS Hits'}],
            seriesDefaults:{
                markerOptions:{
                    show: true,
                    style: 'diamond'
                }
            },
            legend: {
                show: true,
                location: 'nw'
            },
            highlighter: {
                showTooltip: true,
                tooltipFade: true
            }   
        };
        return optionsObj;
    }

    function CreateBarChartOptions()
    {
        var optionsObj = {
            title: 'Blog Statistics',
            axes: {
                 xaxis: {
                    renderer: $.jqplot.CategoryAxisRenderer,
                    ticks: xAxis
                }
            },
            series: [{label:'Page Hits'}, {label: 'RSS Hits'}],
            legend: {
                show: true,
                location: 'nw'
            },
            seriesDefaults:{
                shadow: true,
                renderer:$.jqplot.BarRenderer,
                rendererOptions:{
                   barPadding: 8,
                   barMargin: 10
               }
            },
            highlighter: {
                showTooltip: true,
                tooltipFade: true
            }
        };
        return optionsObj;
    }

    function CreateStackedBarChartOptions()
    {
        var optionsObj = {
            stackSeries: true,
            title: 'Blog Statistics',
            axes: {
                 xaxis: {
                    renderer: $.jqplot.CategoryAxisRenderer,
                    ticks: xAxis
                }
            },
            series: [{label:'Page Hits'}, {label: 'RSS Hits'}],
            legend: {
                show: true,
                location: 'nw'
            },
            seriesDefaults:{
                shadow: true,
                renderer:$.jqplot.BarRenderer
            },
            highlighter: {
                showTooltip: true,
                tooltipFade: true
            }
        };
        return optionsObj;
    }   
</script>
<script language="javascript">
    jQuery("#red").treeview({
     animated: "fast",
     collapsed: true,
     control: "#treecontrol",
     }
    });
</script>

The first script is for a collapsible tree and the second for a chart.. when executed separately the output is fine but when i try to implement both in one page, the tree is not produced properly but the chart is ok.

  • 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-23T00:02:32+00:00Added an answer on May 23, 2026 at 12:02 am

    Take a look at this:

    jQuery(function() {
    
            $.jqplot('chartDiv', [pageHits, rssHits], CreateLineChartOptions());
            /*......*/
            });
    

    If you like to use the dollar-sign to access jQuery inside the function when using jQuery.noConflict(), you’ll need to pass the $ as argument to the function:

    jQuery(function($) {
    
                $.jqplot('chartDiv', [pageHits, rssHits], CreateLineChartOptions());
                /*......*/
                });
    

    You’ll also need to replace all occurences of $ inside CreateLineChartOptions(), CreateBarChartOptions() and CreateStackedBarChartOptions() with jQuery, when using jQuery.noConflict() there will be no global variable $ pointing onto jQuery, that’s the issue.

    So this edited version should work:

        var pageHits = [30,60,22,5,60,88,102];
        var rssHits = [33,45,121,23,55,35,77];
        var xAxis = ['Jan 2009', 'Feb 2009', 'Mar 2009', 'Apr 2009', 'May 2009', 'June 2009', 'Jul 2009'];
    
    
        jQuery(function($) {
    
            $.jqplot('chartDiv', [pageHits, rssHits], CreateLineChartOptions());
    
            $('#barChartButton').click(function() {
                $('#chartDiv').html('');
                $.jqplot('chartDiv', [pageHits, rssHits], CreateBarChartOptions());
            });
            $('#lineChartButton').click(function() {
                $('#chartDiv').html('');
                $.jqplot('chartDiv', [pageHits, rssHits], CreateLineChartOptions());
            });
            $('#stackedBarChartButton').click(function() {
                $('#chartDiv').html('');
                $.jqplot('chartDiv', [pageHits, rssHits], CreateStackedBarChartOptions());
            });
        });
    
    
        function CreateLineChartOptions()
        {
            var optionsObj = {
                title: 'Blog Statistics',
                axes: {
                     xaxis: {
                        renderer: jQuery.jqplot.CategoryAxisRenderer,
                        ticks: xAxis
                    }
                },
                series: [{label:'Page Hits'}, {label: 'RSS Hits'}],
                seriesDefaults:{
                    markerOptions:{
                        show: true,
                        style: 'diamond'
                    }
                },
                legend: {
                    show: true,
                    location: 'nw'
                },
                highlighter: {
                    showTooltip: true,
                    tooltipFade: true
                }   
            };
            return optionsObj;
        }
    
        function CreateBarChartOptions()
        {
            var optionsObj = {
                title: 'Blog Statistics',
                axes: {
                     xaxis: {
                        renderer: jQuery.jqplot.CategoryAxisRenderer,
                        ticks: xAxis
                    }
                },
                series: [{label:'Page Hits'}, {label: 'RSS Hits'}],
                legend: {
                    show: true,
                    location: 'nw'
                },
                seriesDefaults:{
                    shadow: true,
                    renderer:jQuery.jqplot.BarRenderer,
                    rendererOptions:{
                       barPadding: 8,
                       barMargin: 10
                   }
                },
                highlighter: {
                    showTooltip: true,
                    tooltipFade: true
                }
            };
            return optionsObj;
        }
    
        function CreateStackedBarChartOptions()
        {
            var optionsObj = {
                stackSeries: true,
                title: 'Blog Statistics',
                axes: {
                     xaxis: {
                        renderer: jQuery.jqplot.CategoryAxisRenderer,
                        ticks: xAxis
                    }
                },
                series: [{label:'Page Hits'}, {label: 'RSS Hits'}],
                legend: {
                    show: true,
                    location: 'nw'
                },
                seriesDefaults:{
                    shadow: true,
                    renderer:jQuery.jqplot.BarRenderer
                },
                highlighter: {
                    showTooltip: true,
                    tooltipFade: true
                }
            };
            return optionsObj;
        }   
    </script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Why is the first checkbox working but not the second, what am I doing
<html> <head> <title>test</title> <script type=text/javascript> function start(){ document.getElementById(first_div).onclick = function(){ document.getElementById(another_div).style.color = red; };
Update :- My updated script is second one and which is working perfect (
This is the first Python script I've tried to create. I'm reading a xml
This is my first Bash script so forgive me if this question is trivial.
I recently created my first bash script, and I am having problems perfecting it's
I have the following script which first shows only the first para of the
First is there any technique for using Action Script for recording sound from microphone?
First steps in FreeBSD: trying to run my installation script. Fast help needed: #
First, the set up: I have a script that executes several tasks after a

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.