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 9228205
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T05:15:57+00:00 2026-06-18T05:15:57+00:00

i sucessfully rendered d3js area chart in a html page here is the code

  • 0

i sucessfully rendered d3js area chart in a html page here is the code which is rendering sucessfully in chrome or mozilla.The name of the file is say temp.html.Here is the code

<!DOCTYPE html>
<html lang="en" class="no-js">

<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> 
<title>js graphs and charts libraries</title>
<script 
src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script src="http://d3js.org/d3.v3.js"></script>

<body>
    <div id="dbar">

    </div>

<script type="text/javascript"> 
    var margin = {top:10, right: 20, bottom: 30,left: 40},
        width = 960 - margin.left - margin.right,
        height = 400 - margin.top - margin.bottom;
        var svg = d3.select ("#dbar").append("svg").attr("width",
width+margin.left+margin.right).attr("height",height+margin.top+margin.bottom)
.append("g").
attr("transform","translate("+margin.left+","+margin.top+")");
 var parseDate = d3.time.format("%m-%Y").parse;

    var x = d3.time.scale().range([0, width]);
    var y = d3.scale.linear().range([height, 0]);

    var xAxis = d3.svg.axis().scale(x).orient("bottom");

    var yAxis = d3.svg.axis().scale(y).orient("left");

    var area = d3.svg.area().x(function(d) { return x(d.date); })
                .y0(height)
                .y1(function(d) { return y(d.count); });
d3.json("data/json.json", function(error, data) {
      data.StoreVisitGraphCount.list.forEach(function(d) {

        d.date = parseDate(d.date);

        d.count = +d.count;
      });
      //console.log(data.StoreVisitGraphCount.list);
    x.domain(d3.extent(data.StoreVisitGraphCount.list, function(d) {
return d.date; }));
    y.domain([0, d3.max(data.StoreVisitGraphCount.list, function(d) { 
return d.count; })]);
console.log(data.StoreVisitGraphCount.list);
  svg.append("path")
      .datum(data.StoreVisitGraphCount.list)
      .attr("class", "area")
      .attr("d", area);

  svg.append("g")
      .attr("class", "x axis")
      .attr("transform", "translate(0," + height + ")")
      .call(xAxis);

  svg.append("g")
      .attr("class", "y axis")
      .call(yAxis)
    .append("text")
      .attr("transform", "rotate(-90)")
      .attr("y", 6)
      .attr("dy", ".71em")
      .style("text-anchor", "end")
      .text("Price ($)");
    });
</script>

</body>
</html>

But when i am copy pasting this code to say “temp.jsp” page its not rendering and chart is not coming.I am running this page on tomcat server.

need suggestions

  • 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-06-18T05:15:58+00:00Added an answer on June 18, 2026 at 5:15 am

    It is not because you saved it as jsp or html page. You need to add charset=”UTF-8″ to your script declaration as d3.js uses UTF characters.

    eg.

    <script src="http://d3js.org/d3.v3.js" charset="UTF-8"></script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am able to highlight the text on the HTML page(rendered through gtkmozembed), which
So I have had extensive experience reading rendered html source code of a website
I have the following code in a .erb file: <% embed='<a href=http://someurl.com/whatever>#{@webcast.name}</a>'%> <p id=embedCode>
I am successfully using RJS to implement AJAX on a page.replace.html create.js.rjs. I am
I have a commandLink which has a rendered which is calculated based on values
I am having a web page rendered via iframe. On successfully submitting the form
Does anyone have any idea why my chart is not being rendered with Jqplot?
Possible Duplicate: Smart Gwt components are not rendered in html div tag My problem
I can only post one link so here is a reference page with corresponding
I have created a custom server control. It looks great and the rendered HTML

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.