nvd3.js

NVD3 time formatting , line with focus chart

别等时光非礼了梦想. 提交于 2019-12-02 18:31:17
问题 I'm using a fairly simple example of nvd3 line with focus chart. myData returns a JSON object from my php file of which the x-cordinates are numbers from 0-23. I would like to know how to format the x-axis in hours format. d3.json('get_data.php', function (error, myData) { // Renders a line chart (function () { nv.addGraph(function () { var chart = nv.models.lineWithFocusChart(); chart.xAxis .tickFormat(d3.format('')); chart.yAxis .tickFormat(d3.format('')); chart.y2Axis .tickFormat(d3.format

NVD3 time formatting , line with focus chart

牧云@^-^@ 提交于 2019-12-02 09:49:29
I'm using a fairly simple example of nvd3 line with focus chart. myData returns a JSON object from my php file of which the x-cordinates are numbers from 0-23. I would like to know how to format the x-axis in hours format. d3.json('get_data.php', function (error, myData) { // Renders a line chart (function () { nv.addGraph(function () { var chart = nv.models.lineWithFocusChart(); chart.xAxis .tickFormat(d3.format('')); chart.yAxis .tickFormat(d3.format('')); chart.y2Axis .tickFormat(d3.format('')); d3.select("#chart svg") .datum(myData) .transition().duration(500) .call(chart); //Define

AngularJS nvD3 Error - What versions are compatible?

我与影子孤独终老i 提交于 2019-12-02 09:36:11
问题 I have the same problem as with this user: Angular nvD3 Error: Invalid isolate scope definition for directive nvd3 The answer there said "use the latest angularjs" beyond Angular 1.1.4....but I am using the latest AngularJS!! AngularJS v1.6.7 What could I be doing wrong? 回答1: Works with this setup <link rel="stylesheet" href="//unpkg.com/nvd3/build/nv.d3.css"/> <script src="//unpkg.com/angular/angular.js"></script> <script src="//unpkg.com/d3@3/d3.js" charset="utf-8"></script> <script src="/

How to plot time on the X-axis in non-ugly mode?

…衆ロ難τιáo~ 提交于 2019-12-02 08:34:49
This is ugly : I need something that is not ugly. Time series are very usual, but I not see how to build a "plug and play" chart with ISO dates. Perhaps an equivalent question is "How to use d3-scalelinear/Non-numeric range/Date with NVD3?" (or d3-scaletime ) Notes This is the main code: nv.addGraph(function () { var chart = nv.models.discreteBarChart() //.x( d=> d.label ) // very Ugly! .x( d=> { let dd = new Date(d.label); return d3.time.format('%b %d')(dd) }) // Ugly, because need to jump some days before show next .y( d=> d.value ) .staggerLabels(true) // not solved d3.select('#chart svg')

NVD3.js coloring specific bars in graph

孤人 提交于 2019-12-02 07:15:44
问题 Is there a way to color specific bars? If a bar is less than the line, color it red. Code: https://github.com/tvinci/webs/blob/gh-pages/lineplusbar.html Example: http://tvinci.github.io/webs/lineplusbar.html I'd like to do something like this but the value for i is not the y value that I send in. It has been modified: d3.selectAll("rect.nv-bar") .style("fill", function(d, i){ return i > 50 ? "red":"blue"; }); Data: var overview_data=[ { "key" : "Achieved", "bar": true, "values" : [ [ "1x" ,

Set chart area background color in rCharts/slidify/nvd3

南笙酒味 提交于 2019-12-02 07:09:13
For the following slidify deck, --- title : Foo framework : revealjs # {io2012, html5slides, shower, dzslides, ...} revealjs : {theme: solarized} highlighter : highlight.js # {highlight.js, prettify, highlight} hitheme : tomorrow # widgets : [] # {mathjax, quiz, bootstrap} mode : selfcontained # {standalone, draft} ext_widgets : [libraries/nvd3] --- ## NVD3 Plot Iframe ```{r nvd3plot2, results = 'asis', comment = NA, message = F, echo = F} require(rCharts) n1 <- nPlot(mpg ~ wt, data = mtcars, type = 'scatterChart') n1 ``` I want to set the background color of the chart to white. I can do this

AngularJS nvD3 Error - What versions are compatible?

一曲冷凌霜 提交于 2019-12-02 04:24:28
I have the same problem as with this user: Angular nvD3 Error: Invalid isolate scope definition for directive nvd3 The answer there said "use the latest angularjs" beyond Angular 1.1.4....but I am using the latest AngularJS!! AngularJS v1.6.7 What could I be doing wrong? Works with this setup <link rel="stylesheet" href="//unpkg.com/nvd3/build/nv.d3.css"/> <script src="//unpkg.com/angular/angular.js"></script> <script src="//unpkg.com/d3@3/d3.js" charset="utf-8"></script> <script src="//unpkg.com/nvd3/build/nv.d3.js"></script> <script src="//unpkg.com/angular-nvd3/dist/angular-nvd3.js"><

change y axis labels in nvd3 scatter-chart

╄→гoц情女王★ 提交于 2019-12-02 03:23:54
问题 I am trying to have my own y axis labels for the bubble chart in nvd3. Currently the labels are [1,2,3,4,5]. I want them to be displayed as [2,4,8,16,32]. I found the following function, chart.yAxis.tickValues(['2','4','8','16','32']); But the labels are not being changed here. I am unable to understand why. 回答1: These tick values will not have any effect if the y values themselves are not within the 2-32 range. Right now that chart only has y values up to 2+. So, if in addition to adding

NVD3 Horizontal Bar Chart labels too long

╄→尐↘猪︶ㄣ 提交于 2019-12-02 03:02:55
问题 I have data that has long labels, i.e: values: [ { x : "This is a really looong label", y : 40 }, { x : "Short label", y : 30 } ] and only a small portion of the text is shown and the rest is hidden Here is a jsfiddle to demonstrate the issue. Ideally I would like to set a custom width for the labels and/or make them able to use multiple lines if they overflow. Is this possible? 回答1: Why not just add margins? var chart = nv.models.multiBarHorizontalChart() .margin({top: 30, right: 20, bottom:

change y axis labels in nvd3 scatter-chart

ぃ、小莉子 提交于 2019-12-02 02:20:22
I am trying to have my own y axis labels for the bubble chart in nvd3. Currently the labels are [1,2,3,4,5]. I want them to be displayed as [2,4,8,16,32]. I found the following function, chart.yAxis.tickValues(['2','4','8','16','32']); But the labels are not being changed here . I am unable to understand why. These tick values will not have any effect if the y values themselves are not within the 2-32 range. Right now that chart only has y values up to 2+. So, if in addition to adding chart.yAxis.tickValues(['2','4','8','16','32']); to the Chart Code/Javascript tab as you have in your question