Splitting the color legend in a repeat spec in vega - bar-chart

I am using a dataset with the following columns: date, counts, country, engine, and type.
I have created a view with three charts using the repeat operator. The charts show dates on the X axis, counts on Y, and then the bars are split by either country, engine, or type.
I am happy with how things look but I would like to have three separate color legends, one for each domain (so a legend for countries, a legend for type, and a legend for engine). How do I do that?
Here is the link to the editor.

To have independent color scales & legends, add the following at the top level of the chart specification:
"resolve": {"scale": {"color": "independent"}}
For more information, see https://vega.github.io/vega-lite/docs/resolve.html.

Related

Removal of "quasi-label" on bottom axis of mbSelfStack chart

I use TeeChart mbSelfStack chart type to present simulations of rock types down a well. However, on all charts, the name of the first rock type, ordered alphabetically, is always shown on the bottom axis. An example of this is shown in the Tee9New demo in All features|Chart styles|Standard|Bar|Self Stacked where the words Cars can be seen. How to I easily prevent this word from being displayed?

SSRS Match Color series in stacked bar chart

I have a stacked bar chart, with year on the x axis, and sales CY and sales LY on the y axis, also the bars are grouped (stacked) by company name, like in the picture below:
bar chart stacked example
The problem is I want to match the colors for the same companies, like: "united package CY" and "united package LY" have the same color for both, so will be easier to see the comparison between companies and years.
Is there any way to achieve this?
Thanks!
Yes you can, click on your chart and go to the chart properties on the right side under:
Chart > CustomPaletteColors.
Here you can add your defined chart colurs for each series. For example if you have 4 series you have 4 different colors. You can set the color for series1 the same as series2.
Depending on which positions your series are, they will look like one section or they will have another color between them. But you can reorder the position of the series if you need to.

SSRS single bar-chart

Good day all,
Please am trying to create a SSRS report that looks like the image below
i have my table structure in this manner
Please note the data are not in relation with the chart
But all i could get as a result is a multiple bar chart. that resembles the image below.
Thanks in anticipations of your response
First of all, your "Balance on COC" is negative. That's probably not just a chart visualization issue.
You can format the numbers on the y-axis to be more readable like they are in your first screenshot. Click on the Chart Axis and set the LabelsFormat property to #,0;(#,0).
While numbers in the chart can have up to 16 digits, that is highly unreadable for most people. You might want to consider visualizing the numbers in Billions instead.
To get the labels on the x-axis you'll need to set that field as the Category Group. Then you can delete the legend area from the chart. You can also remove the "Axis Title" areas since they are not needed in this case. This will all make it look more polished like the other image.

Different color chart

I have 2 kinds of charts,pie chart and column chart.
I present the same data of both charts, the problem is that color that presents each equipment is not the same in both of them.
Thanks
The chart legend uses color fields to match the legend items to the
visible data points. The legend can only show one color field per
legend item (data series); hence, it shows the color of the first data
point within that series. Remember this when you use expressions to
dynamically determine the color of individual data points within a
series; the legend item always shows the actual color of the first
data point.
Using the same legend order in both charts should do the trick.
Series are ordered in the legend according to the order that they are
processed by the Reporting Services processing engine. You can change
the order by changing the order of fields in the data fields
drop-zone. If you are using series grouping, the series data is not
known until processing, so that there is no way for you to re-order
these items.
If you're using series, which you probably are, you should make sure they're ordered correctly before sending them to the reporter.
Another solution is to create a custom legend for your charts. Which gives you a lot more control, especially if you define a custom color palette aswell.
You can get more flexibility and control over the legend by generating
your own custom legend by using a table or a matrix. The easiest way
to synchronize the colors in the chart with your custom legend is to
define your own custom chart color palette.
To build a custom legend
Add a table data region to the report.
Place the table next to the chart and bind it to the same dataset as the chart.
Mirror the chart grouping structure in the table by adding table
groups.
If the chart uses series groupings, add them to the table by
adding table groups that are based on the same group expression as
the one in the chart series groupings. Then add chart category
groupings (if present) as inner table groups.
In general, if the
chart has m series grouping and n category grouping, you add m+n
table groups for your custom legend.
For the individual table
groups, make sure to show only the group header (which will contain
the legend description). Also, remove the table detail row unless
you want to use the table detail rows to simulate a chart data
table.
Design the custom legend.
Add a rectangle for the color field of the
custom legend. For example, you might add it to the first table
column. As indicated in step 2, you should only have group header
rows in the table. The rectangle goes into the innermost group
header level.
Set the rectangle BackgroundColor property to the equivalent expression used on the chart data point's fill color. In the most
trivial case, the expression would just contain one grouping value as
in the following code.
=Code.GetColor(Fields!Country.Value)
For the legend text, use either the same expression as in the category and series group/label expressions, or experiment until you
achieve the legend description text that you want.
Sources:
Get More Out of SQL Server Reporting Services Charts
Formatting the Legend on a Chart

Is it possible to add items to legend that are not on the chart?

I have a column chart in SSRS with a single series group. The chart is perfect but I need to add a couple of items to the legend even though they are not part of the chart (don't ask). If I add them to the data source with 0 values, the width of my columns still change to reflect the new number of items in my series group.
I ended up using Word to create an image of the proper legend and using this image as my legend. Works great but feels like duct tape.