Altair Scatter Chart - charts

i am looking for a way to make a point chart based on multiple nominal conditions. i am plotting 2 values on x and y, but i would like to differentiate these points based on year as well as 'type'.
currently, the way i do it is to assign year to color while 'type' is assigned to shape
color=alt.condition(selection, alt.Color('Date:T'), alt.value('lightgray'), scheme='red' )
shape = alt.Shape('type:N')
a few questions:
is it possible to change the color scheme of the points instead of the default colors to say shades of red/blue/black, etc?
is it possible to assign one color scheme/shade (instead of shapes) to 'types'?

is it possible to change the color scheme of the points instead of the default colors to say shades of red/blue/black, etc?
Yes, see https://altair-viz.github.io/user_guide/customization.html#customizing-colors. You can use any of the built-in Vega color schemes, or define your own using the methods discussed there. From your example, it might look something like this:
color=alt.condition(
selection,
alt.Color('Date:T', scale=alt.Scale(scheme='reds')),
alt.value('lightgray')
)
is it possible to assign one color scheme/shade (instead of shapes) to 'types'?
No, there is no built-in way to apply two color scales based on two fields in the data (how would a mark choose between the two colors assigned to it?) One possible approach would be to use an opacity encoding for the second field, which is reflected in the lightness of the marks. For your example, it might look like this:
opacity='type:N'

Related

Foundry-Workshop - Charts with multiple layers

I would like to know what are the settings capabilities on workshop charts when implementing multiple layers.
Here is an example of a chart with 2 layers (3 objects):
Among the global settings options, I would like to know:
how to have only one legend per group, instead of one per layer?
how to manage colors? Is it possible to change default?
is there any way to display dotted lines for example?
Thanks in advance
how to have only one legend per group, instead of one per layer?
Currently all the legend "flattens" all the series across all the Plot Layers and there isn't any way to change the grouping. If you really wanted to, you could use a couple metric widgets in List or Tag mode and build your own legend alongside the chart, assuming you'd made overrides for all the potential series and series segments (see below).
how to manage colors? Is it possible to change default?
Yes, you can change the color for each series on the chart. If the series has no "Segement By" config, then you can choose the color directly. If you choose to segment by some other property, then you need to add a Segment Display Override for each segment value that you want to change.
is there any way to display dotted lines for example?
You can change the style from solid to dashed in the same place that you can change the color

How can I make each Packed Bubble a different color?

I have a Packed Bubble dashboard. My Y axis is a list of names and my X axis is a decimal. I want each differing number to be a different color. Can I do this manually?
If you want to color each bubble with a separate color just use the field that each bubble represent in the color shelf. If I understood your data correctly, each bubble basically represents one campaign, so you should use that as the color.
You can manually assign color using Color>Edit Color and assigning the color of your choice.
See image 1.
If you want to color your bubbles based on your measure AVg(NPV/Marketing $) you can do as Alex Blakemore mentioned and use your measure as a stepped color or gradient.
You can use Color>Edit Color here too , in this case manually assigning color is a bit difficult. But if you play with number of steps, the gradient pre-select, etc, you can usually get very close to what ever your wanted it to look like.
Put your numeric field on the color shelf, and either edit the colors to use a stepped set of colors - or change the field to be discrete and choose individual colors to taste.

How to dynamically change the colors of filling in JavaFx 8 area chart depending on whether negative or positive values

I need a area chart that can stylize the chart fill in a different color (red, e.g.) when this be negative.
How to do it in JavaFX?
http://i.stack.imgur.com/SSl5a.png
http://i.stack.imgur.com/nzag3.png
I think the easiest way to achieve this is to create two XYCHartSeries for your Chart.
One for the negative values and one for the positives. Then you can set the color of the ChartSeries with CSS like this:
positiveChart.setId("positiveValues");
positiveChart.setStyle("#positiveValues {-fx-bar-fill: #4CAF50 }");

Is it possible to customize the displayValue color individually in fusioncharts?

I am using the 3D Bar chart in FusionCharts. I have displayValues set to display numeric and textual values above the top of the bars. What I would like to be able to do is set the color of individual displayValues differently, for example, if the year-over-year change is positive, color the displayValue for just that bar to green, if it is negative, color it red, etc. Is this possible?
There is no direct way of coloring data plots or data values based on its value. But FusionCharts has an extensive API used to configure Annotations. You can use this API to create texts (data values). Just a rough thought came into my mind.

UISlider to represent the color spectrum

I have a UISlider that is supposed to update the color of a textlabel. Now I want the user to be able to choose between all colors in the spectrum (sort of all anyway). I was thinking of using this UISlider to represent the colors and when dragging the slider the value/color changes.
I know the spectrum is not sequential like: [0,0,0]...[255,0,0]...[255,1,0]...[255,255,0] etc.
So: any tip on how I can implement this?
Color is at least a two or three dimensional selection. And a slider only provides a scalar output. If you want a smoothly changing selection using only a scalar parameter, you might try drawing a path line on some color chart (or a functional representation thereof) and select a point on that path parametrically.
Yes, color is a multidimensional value, but there are different ways to slice those dimensions. I think a hue, saturation, brightness constructor, rather than RGB, will give you exactly the effect you want. For example, often I will generate a random color with [UIColor colorWithHue:<random float in [0,1]> saturation:1.f brightness:1.f alpha:1.f].
Slide hue linearly from 0 to 1, with saturation and brightness fixed at the most legible (or whatever) values.