Mapping color to data for data bound objects
Embodiments are disclosed for binding colors to data visualizations on a digital canvas. In some embodiments, a method of binding colors to data visualizations includes receiving a data set including data associated with a variable. A chart, including a plurality of graphic objects, is generated based on the variable of the data set and a visual property of the plurality of graphic objects. A data type associated with the variable determined and first colors are assigned to the plurality of graphic objects based on the data type using a color binding. A selection of second colors to be assigned to the plurality of graphic objects is received and the chart is updated using the second colors.
1 . A method comprising:
receiving a first data set including data associated with a variable;
generating a first chart, including a first plurality of graphic objects, based on the variable of the first data set and a visual property of the first plurality of graphic objects;
determining a data type associated with the variable;
binning the data based at least on the data type into a plurality of bins;
assigning first colors and a color fill type to the first plurality of graphic objects based on the plurality of bins using a color binding, wherein the color binding associates each bin from the plurality of bins with a different color from the first colors and the color fill type;
generating a second chart, including a second plurality of graphic objects, based on a second data set including second data associated with a second variable;
receiving a first selection of the first chart;
retrieving the color binding associated with the first chart based on the first selection;
applying the color binding associated with the first chart to the second chart to assign the first colors and the color fill type to the second plurality of graphic objects;
receiving a second selection of second colors to be assigned to the first plurality of graphic objects; and
updating the first chart using the second colors.
2 . The method of claim 1 , wherein the color binding defines a relationship between color values of the first colors and data values of the variable.
3 . The method of claim 1 , wherein assigning the first colors and the color fill type to the first plurality of graphic objects based on the plurality of bins, further comprises:
determining the first colors based on a gradient, wherein the data type is numerical, wherein the gradient includes a first color stop associated with a maximum numerical value and a second color stop associated with a minimum numerical value; and
assigning the first colors to the first plurality of graphic objects based on the gradient and numerical values associated with each graphic object.
4 . The method of claim 3 , further comprising:
updating the first color stop to be associated with a value larger than the maximum numerical value of the data; and
updating the second color stop to be associated with a value smaller than the minimum numerical value of the data.
5 . The method of claim 3 , further comprising:
associating the gradient with a new color space; and
assigning the second colors from the new color space.
6 . The method of claim 1 , wherein assigning first colors to the first plurality of graphic objects based on the plurality of bins, further comprises:
determining a number of categories associated with the data, wherein the data type is categorical, wherein each category is associated with a different bin;
selecting a number of first colors equal to the number of categories; and
assigning a different first color to each graphic object associated with a different category.
7 . The method of claim 1 , further comprising:
displaying a luminosity chart that shows a luminosity value associated with each first color; and
replacing one or more first colors with one or more second colors based on luminosity values.
8 . The method of claim 1 , wherein receiving the second selection of second colors to be assigned to the first plurality of graphic objects, further comprises:
receiving a selection of at least one second color using a color picker.
9 . The method of claim 1 , wherein updating the first chart using the second colors, further comprises:
updating the color binding to define a relationship between color values of the second colors and data values of the variable.
10 . A non-transitory computer-readable medium storing executable instructions, which when executed by a processing device, cause the processing device to perform operations comprising:
receiving a first data set including data associated with a variable;
generating a first chart, including a first plurality of graphic objects, based on the variable of the first data set and a visual property of the first plurality of graphic objects;
determining a data type associated with the variable;
binning the data based at least on the data type into a plurality of bins;
assigning first colors and a color fill type to the first plurality of graphic objects based on the plurality of bins using a color binding, wherein the color binding associates each bin from the plurality of bins with a different color from the first colors and the color fill type;
generating a second chart, including a second plurality of graphic objects, based on a second data set including second data associated with a second variable;
receiving a first selection of the first chart;
retrieving the color binding associated with the first chart based on the first selection;
applying the color binding associated with the first chart to the second chart to assign the first colors and the color fill type to the second plurality of graphic objects;
receiving a second selection of second colors to be assigned to the first plurality of graphic objects; and
updating the first chart using the second colors.
11 . The non-transitory computer-readable medium of claim 10 , wherein the color binding defines a relationship between color values of the first colors and data values of the variable.
12 . The non-transitory computer-readable medium of claim 10 , wherein the operation of assigning the first colors and the color fill type to the first plurality of graphic objects based on the plurality of bins, further comprises:
determining the first colors based on a gradient, wherein the data type is numerical, wherein the gradient includes a first color stop associated with a maximum numerical value and a second color stop associated with a minimum numerical value; and
assigning the first colors to the first plurality of graphic objects based on the gradient and numerical values associated with each graphic object.
13 . The non-transitory computer-readable medium of claim 12 , wherein the operations further comprise:
updating the first color stop to be associated with a value larger than the maximum numerical value of the data; and
updating the second color stop to be associated with a value smaller than the minimum numerical value of the data.
14 . The non-transitory computer-readable medium of claim 12 , wherein the operations further comprise:
associating the gradient with a new color space; and
assigning the second colors from the new color space.
15 . The non-transitory computer-readable medium of claim 10 , wherein the operation of assigning first colors to the first plurality of graphic objects based on the data type, further comprises:
determining a number of categories associated with the data, wherein the data type is categorical, wherein each category is associated with a different bin;
selecting a number of first colors equal to the number of categories; and
assigning a different first color to each graphic object associated with a different category.
16 . The non-transitory computer-readable medium of claim 10 , wherein the operations further comprise:
displaying a luminosity chart that shows a luminosity value associated with each first color; and
replacing one or more first colors with one or more second colors based on luminosity values.
17 . The non-transitory computer-readable medium of claim 10 , wherein the operation of receiving the second selection of second colors to be assigned to the first plurality of graphic objects, further comprises:
receiving a selection of at least one second color using a color picker.
18 . The non-transitory computer-readable medium of claim 10 , wherein the operation of updating the first chart using the second colors, further comprises:
updating the color binding to define a relationship between color values of the second colors and data values of the variable.
19 . A system comprising:
a memory component; and
a processing device coupled to the memory component, the processing device to perform operations comprising:
receiving a first data set;
generating a first plurality of graphic objects based on the first data set and a visual property of the first plurality of graphic objects;
determining a gradient color fill is applicable to the plurality of graphic objects based on a data type of the first data set;
determining a scale associated with the first data set;
determining a plurality of color stops associated with the first data set based on the scale;
creating a color binding that identifies at least the first data set and the plurality of color stops for the gradient color fill;
assigning colors to the plurality of graphic objects using the color binding;
receiving a second data set;
generating a second plurality of graphic objects based on the second data set and a visual property of the second plurality of graphic objects;
receiving a selection of the first plurality of graphic objects;
retrieving the color binding associated with the first plurality of graphic objects based on the selection; and
applying the color binding associated with the first plurality of graphic objects to the second data set to assign the plurality of color stops for the gradient color fill to the second plurality of graphic objects.
20 . The system of claim 19 wherein the color binding defines a relationship between color values of the colors and data values of the data set.