dc-js / dc.js

Multi-Dimensional charting built to work natively with crossfilter rendered with d3.js
Apache License 2.0
7.41k stars 1.81k forks source link

Stocks examples #1845

Closed kum-deepak closed 2 years ago

kum-deepak commented 2 years ago

Following are the changes:

In general, the newer syntax looks alright. The color scale setting in the case of Bubble Chart seems quite clumsy, I guess I will add suitable methods to the color mixin.

Based on your feedback, I will update other samples.

kum-deepak commented 2 years ago

Once the sample is finalized, I will update the comments which are used by docco.

kum-deepak commented 2 years ago

I have moved back most of the ColorMixin helpers from compact to the mainline version. Now the code reads much better.

kum-deepak commented 2 years ago

I looked at the bubble chart color scale before and after, and I agree this is a big improvement. Could we call it colorScale instead of scaledColors? As "color scale" is a standard D3 concept name.

Good idea, pushed as a commit.

In general I think we should try to keep the external interface as simple as it was, while cleaning up internal interfaces. This means that there will usually have to be sugar like this to hide the Helpers. Ideally users would only encounter Helpers if they are trying to do something extraordinary. (Example: if we didn't already have a precedent for colorCalculator, this would be the kind of deep customization where using the Helpers makes sense.)

Makes perfect sense. During updating other examples, I am sure more such cases would surface.

I have a general question about .configure(); apologies if we have discussed this before. Which (kinds of) properties now go into .configure(), and which ones remain as getter/setters with private fields? Example: I see that minWidth is now a configuration property, but width and height remain as fields. What is the rule of thumb for which goes where? Is the goal for all properties eventually to go in the configuration?

In this example, could colorScale be a configuration property?

In general I like .configure() better, because the order of setting properties should not matter. (As we know, it currently does matter in a lot of places.)

I'd like to see the "Key/value pair configuration" rule of thumb / rationale spelled out in the migration guide, as well as the DataProvider concept. All this stuff should become clear as we do these reviews.

Currently, for charts, I have kept the following criteria:

In general, I am good with merging this, but let's continue to discuss the design rationale so that we can document it.