Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for objects in data array #73

Closed
jakezatecky opened this issue Jun 8, 2017 · 0 comments
Closed

Add support for objects in data array #73

jakezatecky opened this issue Jun 8, 2017 · 0 comments

Comments

@jakezatecky
Copy link
Owner

Pursuant to #71, the current data structure is problematic. Currently, the data array is an array of arrays with the following configuration:

const data = [
    ['Zerg', 400, '#9ee79d'],
];

This array can be extended in a number of ways to support block-level formatting, background colors, and label colors. This design makes it increasingly difficult to support additional block options, as they would be additional elements to the array, and the user would be forced to stuff null into the configuration options that are not desired.

For example, to set a label color, but keep the default background, the user would have to do the following:

const data = [
    ['Protoss', 100, null, '#56b1ff'],
];

Instead, it would be better to support an array of objects, and eventually deprecate the array of arrays format:

const data = [{
    label: 'Terran',
    value: 200,
    backgroundColor: '#e5b81f',
}];

We would need to translate the legacy block arrays into key/value objects. This should require minimal effort, and allow the library to offer even greater individual block-level configurations.

@jakezatecky jakezatecky added this to the Release 1.1 milestone Jun 8, 2017
jakezatecky added a commit that referenced this issue Jun 8, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant