{"id":7541,"date":"2015-07-26T05:12:13","date_gmt":"2015-07-26T05:12:13","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2015\/07\/26\/how-to-set-the-domain-and-scale-on-an-yaxis-on-a-discretebarchart-nvd3-js-open-source-projects-novus-nvd3\/"},"modified":"2015-07-26T05:12:13","modified_gmt":"2015-07-26T05:12:13","slug":"how-to-set-the-domain-and-scale-on-an-yaxis-on-a-discretebarchart-nvd3-js-open-source-projects-novus-nvd3","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2015\/07\/26\/how-to-set-the-domain-and-scale-on-an-yaxis-on-a-discretebarchart-nvd3-js-open-source-projects-novus-nvd3\/","title":{"rendered":"How to set the domain and scale on an yaxis on a discreteBarChart nvd3.js-open source projects novus\/nvd3"},"content":{"rendered":"<p>I&#8217;m using d3.js charts in one of my applications. Here they are in this image See Charts<\/p>\n<p>For Y axis on Money chart (See in the Image), I want maximum value rounded to 400, no matter what maximum bar size is here it is $358.72, but I want to keep bar at 358.72 but on Y Axis it would be 400 Limit.<\/p>\n<p>Code for it is here<\/p>\n<pre><code>tradesChart = [ \n      {\n        key: \"Cumulative Return\",\n        values: [\n                        {\n            \"label\" : \"6E\",\n            \"value\" : 100       },\n                    {\n            \"label\" : \"NG\",\n            \"value\" : 100       },\n                    {\n            \"label\" : \"TF\",\n            \"value\" : 67        }        ]\n      }\n    ];\n        nv.addGraph(function() {\n\n      var chart = nv.models.discreteBarChart()\n          .x(function(d) { return d.label })\n          .y(function(d) { return d.value\/100 })\n          .staggerLabels(true)\n          .showValues(true)\n          .valueFormat(d3.format('.0%'))\n\n      chart.yAxis.tickFormat(function(d) { return d3.format('d')(d*100) + '%'; });\n\n      d3.select('#chart-trades svg')\n        .datum(tradesChart)\n        .transition().duration(500)\n        .call(chart);\n\n      nv.utils.windowResize(chart.update);\n\n      return chart;\n    });\n<\/code><\/pre>\n<p>Kindly Help me to solve this out<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;m using d3.js charts in one of my applications. Here they are in this image See Charts For Y axis on Money chart (See in the Image), I want maximum value rounded to 400, no matter what maximum bar size is here it is $358.72, but I want to keep bar at 358.72 but on [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-7541","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/7541","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=7541"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/7541\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=7541"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=7541"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=7541"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}