Call evalMetric or evalMetrics on a non MetricEvaluatable


#1

I was wondering if it is possible to evaluate a metric on a non MetricEvaluatable type. The evalMetric method is static so why can’t we just call it directly like a c3Grid or c3Viz method on a specific type like:

c3EvalMetric(MyType, { id: ..., expression: ...})

May be it is important to mixe MetricEvaluatable for some reasons, but it would be convenient to have such additional method to avoid modifying existing type and also for prototyping/debugging (the same we do with evalMetricsWithMetadata)


#2

The idea of making evalMetricsWithMetadata static and take an additional srcType argument (as part of the spec maybe) was brought up and might be part of a future release.

In the meanwhile the MetricEvaluatable functions are static but bound to the srcType you call them from (that’s how we figure out which SimpleMetric to pick if multiple are defined).