Daniel Krizan
Daniel Krizan

Reputation: 11

d3.dart 0.2.0 - method not found: '_proxy'

I am starting to use a dart API for d3.js (found here: https://pub.dartlang.org/packages/d3) and I came across a problem, when I tried to create a Axis using TimeScale.

Console:

oSuchMethodError: method not found: '_proxy'
Receiver: Instance of 'TimeScale'
Arguments: []

timeline.dart code

x = new time.TimeScale()
  ..range([0, width])
  ..domain([new DateTime(1999, 0, 1), new DateTime(2014, 0, 0)]);

x = new svg.Axis()
  ..scale(x);

Log:

#0      Object._noSuchMethod (dart:core-patch/object_patch.dart:44)
#1      Object.noSuchMethod (dart:core-patch/object_patch.dart:47)
#2      getProxy (package:d3/src/js/scale.dart:679:31)
#3      Axis.scale (package:d3/src/js/svg.dart:867:16)
#4      Timeline.attached (http://localhost:20080/frontend/dart/components/timeline.dart:29:9)
#5      Application.init.<init_async_body>.<anonymous closure> (http://localhost:20080/frontend/dart/application/application.dart:128:25)
#6      _HashVMBase&MapMixin&&_LinkedHashMapMixin.forEach (dart:collection-patch/compact_hash.dart:351)
#7      Application.init.<init_async_body> (http://localhost:20080/frontend/dart/application/application.dart:105:37)
#8      Future.Future.microtask.<anonymous closure> (dart:async/future.dart:144)
#9      _microtaskLoop (dart:async/schedule_microtask.dart:41)
#10     _startMicrotaskLoop (dart:async/schedule_microtask.dart:50)
#11     _ScheduleImmediateHelper._handleMutation (dart:html:49308)
[[class]]: _StackTrace(anonymous function) @ VM2334:1
VM2334:1 Uncaught Unhandled exception:
Closure call with mismatched arguments: function '_proxy'

NoSuchMethodError: method not found: '_proxy'
Receiver: Instance of 'TimeScale'
Arguments: []
#0      Application.init.<init_async_body>.<anonymous closure> (http://localhost:20080/frontend/dart/application/application.dart:131:21)
#1      _HashVMBase&MapMixin&&_LinkedHashMapMixin.forEach (dart:collection-patch/compact_hash.dart:351)
#2      Application.init.<init_async_body> (http://localhost:20080/frontend/dart/application/application.dart:105:37)
#3      Future.Future.microtask.<anonymous closure> (dart:async/future.dart:144)
#4      _microtaskLoop (dart:async/schedule_microtask.dart:41)
#5      _startMicrotaskLoop (dart:async/schedule_microtask.dart:50)
#6      _ScheduleImmediateHelper._handleMutation (dart:html:49308)(anonymous function) @ VM2334:1

d3/src/js/scale.dart - line 679

JsObject getProxy(arg) => arg._proxy;

d3/src/js/svg.dart

  scale([scale = undefined]) {
    var args = [];
    if (scale != undefined) {
      //line 867
      args.add(sc.getProxy(scale));
    }
    var retval = _proxy.callMethod('scale', args);
    if (scale == undefined) {
      return retval; // TODO: wrap in Scale
    } else {
      return new Axis._(retval);
    }
  }

Did anyone know what's wrong ?

Thanks

Upvotes: 1

Views: 60

Answers (1)

Alexandre Ardhuin
Alexandre Ardhuin

Reputation: 76183

Looking at the package code, you will only be able to give a scale parameter that belong to d3/src/js/scale.dart library.

Using a private member like in arg._proxy will retrieve the _proxy attribute only for arg inside the same library (that's what the prepending _ means : private to its library).

Unfortunately I don't see any simple solution to workaround your issue with the current package sources.

Upvotes: 0

Related Questions