What does it need to specify the category order in a colored and patterned pie chart in SPSS? - pie-chart

I created a colored and patterned pie chart as described in this stack exchange Question.
Now I also want to specify an order of the categories to apear in the pie chart.
Usually this works with the sort.values funtion:
SCALE: cat(aesthetic(aesthetic.color), sort.values("value", "value",...))
However this function doesn't seem to have an effect when having both color(var)) and
texture.pattern(var) functions inside the same ELEMENT-Statement.

You also need to specify the category order for the texture.pattern. So add the line:
SCALE: cat(aesthetic(aesthetic.texture.pattern), sort.values("value", "value", ...))
Defining the category order for both, the color aesthetic and the texture.pattern aesthetic should result in the specific ordered pie chart.
Unfortunatly the order isn't applyied to the legend, which is quiet a bummer when trying to read the pie chart. I haven't figured out how or if this can be fixed.

Related

Merging Percentage Lines with The Bars in Tableau Desktop

I have a graph that shows the ratio (count) of payable vs. processed words among the total words on stacked bars. I would also like to display the same ratio in percentages in lines overlapping the bars.
At the moment I have them in two separate graphs, but I want to merge them so that it takes less space in my dashboard view. I am unable to select the dual combination view as it requires two measures and even though I keep trying to cmd+click+drag the percentage measure pill to my marks, it's only changing the calculations in the bars but not allowing me to select the dual combination view.
Since the percentages are basically the ratio of the green/total in the bars, I don't think I need any complicated configurations for displaying it, however, I am also failing to achieve what I want.
Could you please tell me how to do this visualization?
Edit: I noticed that the reason I couldn't generate the dual combination view was that I had three date pills (year, quarter, month), and by removing two of them, I'm able to generate the dual combination view, but it's far from what I'm looking for as it's only splitting the stacked bar into bar+line.
Neeku, I certainly understand the desire to minimize "real estate" in your dashboard. If I understand your needs correctly, I believe that overlaying a transparent-background chart over the first chart might meet your needs, if a dual-axis chart doesn't work for you (for example, if you wanted to overlay a line chart on a column chart that is itself already dual axis).
By way of example, here is a simple Sample Superstore dashboard with a line chart on top and a stacked column at the bottom.
simple dashboard
Change the line chart to "Floating"
Size it to fit over your column chart and change the background to transparent by clicking anywhere in the line chart and select "Format"
...Format Shading
...and "None" for the color selection
Your line chart is now an overlay, but it's pretty messy.
Click on the line chart and hide field labels,
...turn off "Show Header" for each pill in the line chart
Clean things up and it should look better:
Note: one big issue with this approach is that you will not be able to click to select chart elements of the underlying chart.

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 to achieve this kind of heatmap / bar chart with Chart.js

I have to build a horizontal bar with chartjs. I already built a few of them but its a bit different. The chart has 2 labels for the yAxis ("Storm Risk", "Ice Risk") and hours for the xAxes. I have to print out for every hour one of these different options with different colors ("Low", "Medium", "Hight") as ye can see in the screenshot attached.
This kind of bar chart usually the values are represented by the length of the bar and its a bit different.
Any suggestion?.
Thanks
The chart you want to implement is a sort of a "heatmap". As of now (Sep. 2018), Heatmap charts are not supported out of the box by Chart.js. However, you can make one out of a stacked bar chart (in this case, probably stacked horizontal bar chart?): make each stack size equal to one another and each item backgroundColor depending on the actual values being represented. Once this is done, you can override ticks and tooltips using with according callbacks. Legend can be implemented by one more bar chart with sample values and colors.
More details can be found in a related GitHub issue: https://github.com/chartjs/Chart.js/issues/4627
Another alternative would be to use a BubbleChart. The strategy would be similar - you would need to make all bubbles same size, but override their colors. However, provided the look in the question, stacked horizontal bar chart will be more suitable.
Another option for those who are still looking is to use chartjs-chart-matrix https://chartjs-chart-matrix.pages.dev/usage.html plugin.
Example of implementation with Chart.js v3: https://www.youtube.com/watch?v=bi04BgvNY6U

Change pie chart color in Kibana

One of my uses of Kibana is related to displaying some information in certain cases only (say when a value is unexpected and exceeds a defined range). This element is therefore either shown or hidden from the dashboard, and displaying it could be considered as displaying an alert. I would prefer if the related pie chart was filled in red, rather than the default green.
Any ideas on how to do this?
Assuming you are describing Kibana 3, if you want terms panels pie charts to use different colors, you will need to make a code change.
There is a way to have custom colors for your pie chart. In order to do that you'll need to create a "hits" panel and pick the "pie chart" as the display. The color of the pie slices will be determined by the color that you chose for the queries that they track:

How to dynamically change line style in JavaFX 2.0 line chart?

In our JavaFX project we need a line chart. I can easy stylize the whole chart and series using CSS, but content of our chart can change dynamically:
number of series and their displaying order depends on user actions and his data. Each series represents a concrete data category and the each category has its own style, eg. category A is shown as a dotted line and category B is shown as a dashed line. The chart can contain 0 or more series for each category,
style of series depends on data values too, eg. series line over the average is red, and below is blue.
How to do it in JavaFX?
number of series and their displaying order depends on user actions and his data.
The number of series displayed and the display order can be modified by changing the ObservableList of series which you passed to the chart's setData() call. As the chart listens for changes to the list, as the backing list changes, the chart is automatically updated to reflect the changes.
each category has its own style, eg. category A is shown as a dotted line and category B is shown as a dashed line.
This can done by determining which series in the chart is in which category, looking up all nodes related to the series via the node lookupAll(cssStyleSelector) function and applying a new custom style to the series which matches the style for the category. Dotted and dashed lines can be styled via css by setting the -fx-stroke-dash-array css property. Alternately, rather than a lookup you can dynamically change the css styleclass assigned to nodes via modifying the ObservableList returned from getStyleClass().
style of series depends on data values too, eg. series line over the average is red, and below is blue.
This is similar to how the dotted and dashed lines are displayed, but instead the color of the lines are modifed by the -fx-stroke css property and the modification depends on the average values calculated for the series.
To demonstrate the above points, I created a sample solution for this question here: https://gist.github.com/2129306
I did it like this, thought it was pretty handy. Note: This apparently works on LineCharts but not ScatterCharts.
Series<Number, Number> series = new Series<>();
...
series.nodeProperty().get().setStyle("-fx-stroke-width: 1px;");