Error problem parsing d: only in lineChart
The querytime is basically just the date until minutes. The group is the maximum querytime by minute. If their are more max querytimes on a minute then it will take the average.
My json looks like this:
["48707","be-ometa-joey","16","","18/03/2013 03:41:20.000","18/03/2013 03:41:20.213","0.213","ODBCTST","ODBCTST","ShareDoc_Programs","GetAllProgramsPerContractsRW ","","Goed","15","18","Production","18/03/2013","Out_4755","0.356"]
In this case e[5] = 18/03/2013 03:41:20.213 v[18]= 0.356
data.forEach(function (e) {
e.dd = dateFormat.parse(e[5]);
e.month = d3.time.month(e.dd);
e.day = d3.time.minute(e.dd);
});
var querytime = calls.dimension(function (d) {
return d.day;
});
var queryMaxByMinuteGroup = querytime.group().reduce(
function (p, v) {
p.days++;
p.id = (+v[0]);
p.total += +v[18];
p.avg = p.total / p.days;
return p;
},
function (p, v) {
p.day--;
p.id = (+v[0]);
p.total -= +v[18];
p.avg = p.total / p.days;
return p;
},
function () {
return { days: 0, total: 0, avg: 0, id: 0 };
}
);
lineChart
.width(1200)
.height(200)
.transitionDuration(500)
.margins({ top: 10, right: 50, bottom: 30, left: 40 })
.dimension(querytime)
.group(queryAvgByMonthGroup)
.valueAccessor(function (d) {
return d.value.avg;
})
.elasticY(false)
.yAxisPadding(0)
.elasticX(false)
.xAxisPadding(0)
.x(d3.time.scale().domain([new Date(previous.getFullYear(), previous.getMonth(), previous.getDate() - 1), new Date(now.getFullYear(), now.getMonth(), now.getDate() + 1)]))
.xUnits(d3.time.minute)
.round(d3.time.minutes.round)
.renderHorizontalGridLines(true)
.renderVerticalGridLines(true)
.brushOn(false)
.title(function (d) { return "Value: " + d.value.avg + "\n" + "Date:" + d.key + "\n" + "ID:" + d.value.id; })
.renderTitle(true);
When i draw a barChart based on this it works accordingly.

When i draw the lineChart it still works however when i start filtering then problems start occuring.

It gets wierd if i select the beginning of the volumeChart, the lineChart does render but towards the end it doesn't anymore.

Error: Problem parsing d="M-18345.814761021797,170L-18343.91518961283,170L-17485.942103231133,170L-17432.754103780164,170L-17415.657961099496,170L-17413.758389690534,170L-16612.77244557773,170L-16608.340112290152,170L-16585.545255382593,-InfinityL-16584.912064912936,-InfinityL-16584.278874443284,InfinityL-16583.645683973627,-InfinityL-16581.746112564666,InfinityL-16581.11292209501,-InfinityL-16577.94696974674,-InfinityL-16574.78101739847,-InfinityL-16574.147826928813,-InfinityL-16573.51463645916,InfinityL-16571.615065050195,-InfinityL-16570.981874580542,-InfinityL-16567.81592223227,InfinityL-16567.182731762616,InfinityL-16565.916350823307,InfinityL-16554.518922369527,InfinityL-16552.619350960565,InfinityL-16551.352970021257,InfinityL-16550.086589081944,InfinityL-16549.45339861229,-InfinityL-16548.187017672983,-InfinityL-16547.553827203326,-InfinityL-16546.920636733674,-InfinityL-16546.287446264017,InfinityL-16545.654255794365,-InfinityL-16545.02106532471,InfinityL-16541.85511297644,InfinityL-16541.221922506786,InfinityL-16540.58873203713,InfinityL-16514.6279227813,InfinityL-16513.994732311647,InfinityL-16282.880210887794,170L-16282.247020418137,170L-16253.753449283693,170L-16241.72283036026,170L-16220.827544861664,-InfinityL-16206.897354529265,-InfinityL-16206.264164059612,170L-16204.364592650649,170L-16201.198640302377,InfinityL-16200.565449832722,-InfinityL-15707.943264441607,-InfinityL-15707.310073971952,170L-15705.410502562992,170L-15704.777312093338,InfinityL-15704.144121623682,170L-15697.179026457483,-InfinityL-15696.545835987828,170L-15694.01307410921,170L-15693.379883639556,InfinityL-15692.746693169902,-InfinityL-14698.004465342858,170L-14697.371274873203,170L-14696.738084403549,InfinityL-14694.838512994585,170L-14687.873417828387,170L-14685.973846419425,-InfinityL-14685.34065594977,170L-14491.584372235526,170L-12056.333825944743,170L-12053.801064066127,170L-12052.534683126818,170L-12043.670016551656,170L-11961.355255496586,170L-11956.922922209005,170L-11954.390160330388,170L-11903.101732288382,170L-11692.24930589347,170L-11691.616115423818,170L-11690.982924954162,InfinityL-11690.349734484507,InfinityL-11687.183782136235,170L-11686.55059166658,170L-11684.651020257617,InfinityL-11680.85187743969,170L-11677.052734621766,170L-11646.659592078353,170L-11637.161735033538,170L-11635.89535409423,170L-11610.567735308054,170L-11076.154978919749,170L-11075.521788450094,-InfinityL-11074.255407510786,170L-11066.657121874934,170L-11061.591598117699,170L-10819.079648240067,-InfinityL-10818.446457770413,InfinityL-10238.44398756699,170L-10232.112082870446,170L-10223.88060676494,170L-10221.981035355977,170L-10171.325797783626,170L-10170.692607313971,InfinityL-10163.09432167812,InfinityL-10161.194750269156,170L-10160.561559799502,170L-10158.028797920884,170L-9890.189229257077,170L-9889.556038787423,170L-9881.957753151572,170L-9876.25903892468,170L-9874.99265798537,170L-9874.359467515716,170L-9873.726277046062,170L-9871.193515167444,170L-9867.39437234952,170L-9866.761181879865,170L-9864.228420001247,-InfinityL-9863.595229531593,InfinityL-9862.962039061938,InfinityL-9861.062467652975,170L-9854.73056295643,InfinityL-9853.464182017122,170L-9852.830991547467,170L-9847.13227732058,InfinityL-9846.499086850925,170L-9843.966324972307,InfinityL-9840.800372624035,170L-9839.533991684726,170L-9838.900801215072,170L-9312.086330462618,-InfinityL-9308.920378114348,170L-9306.38761623573,170L-9302.588473417803,-InfinityL-9286.758711676444,170L-9286.12552120679,170L-9219.007331423425,170L-9218.37414095377,170L-9205.077141091027,170L-9203.810760151719,InfinityL-9203.177569682064,InfinityL-8922.67419162517,170L-8920.774620216207,170L-8906.84442988381,170L-8904.311668005192,170L-8899.246144247956,170L-8896.71338236934,170L-8894.180620490723,170L-8892.914239551414,170L-8888.481906263833,170L-8884.049572976252,170L-8882.15000156729,170L-8879.617239688672,170L-8878.350858749363,InfinityL-8083.063628863449,170L-8082.430438393796,170L-8081.79724792414,170L-8081.164057454487,170L-8064.067914773819,170L-8062.80153383451,-InfinityL-8062.168343364856,170L-8061.535152895201,170L-8048.2381530324565,170L-8045.072200684187,170L-8044.439010214531,170L-8043.805819744877,170L-8030.508819882136,170L-8027.976058003517,170L-8017.845010489047,170L-7977.320820431165,170L-4493.506856392715,170L-4472.61157089412,170L-4462.480523379651,170L-2905.4651584995063,170L-2904.1987775601974,170L-2894.0677300457273,170L-2802.255111945841,170L-2024.6972152102508,170L-2018.9985009833608,170L685.3579949105367,164L685.9911853801912,166L686.6243758498455,160L687.2575663194999,161L687.8907567891542,157L696.1222328946614,157L698.6549947732789,164L700.5545661822421,159L702.4541375912053,158L703.0873280608596,158L704.3537090001684,158L706.886470878786,162L720.1834707415281,162L743.6115181187406,157L1035.5123246294143,159L1045.6433721438843,161L4327.469576362585,170L4328.1027668322395,170"
Thank you for your time my project is almost complete :)
Is it possible you have a dividing by zero problem in your reduce function?
Yes got it fixed another thing maybe, Im trying to change the dimension of the barChart when you select a brush in the volumeChart.
I can change the dimension that part is working but the barChart itself doesnt use the new dimension that i gave it. Even if i do barChart.doRender(); barChart.doRedraw();
Most of dc charts cache some of the information derived from dimension and group for performance reason, so switching dimension and group at runtime is not really supported right now. Why are you changing the dimension? whats the use case?
Well i have a big dataset about 600 000 records and counting and each of them has a column execution time and a date and so on.... What i would like to do is depending on the scale of the chart ==> change the dimensions. I currently have two datepicker fields at the top of my page where i choose a range of data between these two dates. I also use these two dates to dynamically modify the scale of my charts.
The problem is if i select a year so for example 16/04/2012 - 16/03/2013 then the chart would need to render all the records between this range which is quite alot and its making the chart render really slowly.
I came up with a solution i just group them by day or by hour or by minute. So my idea is to create 3 dimensions:
foreach( d.day = d3.time.day (my date field) d.hour = d3.time.hour(my date field) ...... )
querytimebyday = calls.dimension (function (d){ return d.day; });
querytimebyhour = calls.dimension (function (d){ return d.hour; });
querytimebyminute = calls.dimension (function (d){ return d.minute; });
Now im using the volumeChart like in the nasdaq example to filter my barChart. What im doing now im counting the days between the selected brush.
So if i select a year in my datepicker fields it would be 365 and i would modify my dimension to querytimebyday.
This makes my chart render very quickly. Then if i select a smaller range so for example one day then i would change my dimension to querytimebyminute. This way you basically drilldown using the volumeChart and you have the advantage of quick render speeds with a big dataset.
Is their any way i could right a function that would redraw the chart based on the new dimension ?
I understand your use case now; will do some investigation to see how I can support this.
On Wed, Apr 17, 2013 at 6:12 AM, pdaems [email protected] wrote:
Is their any way i could right a function that would redraw the chart based on the new dimension ?
— Reply to this email directly or view it on GitHubhttps://github.com/NickQiZhu/dc.js/issues/154#issuecomment-16497570 .
This is related to issue [#146] and implemented on master for v1.3 release