Chartjs: customise legend based on background color - chart.js

I am creating a bar chart using charts. The current work is below:
The colour represents continents. Notice that the default legend is blue showing undefined. I want to have the legends showing each colour and its represented continent. That is, to be able to display legends of the bar's background and customise their label.
How can I achieve that?
Really appreciate your help! Thanks

Instead of putting all your data in a single dataset you will need to make a different dataset for each continent and then set the label of that dataset to the continent

Related

Fixed defined color in the diagram

In a bar chart I display two values. OK and Not_OK. Only the bar of OK is displayed in red and the bar of Not_OK in green. I have the feeling APEX assigns color by chance. Can I define the color for the respective value?
You can define the color in the series of your chart. I have built a sample application you can see here.
If both bars are defined in the same series, you can create a column for the color, then reference that column in Color field of the series. If the two bars are defined in different series, you can use the same method, or select a color to use for that series.

How to create custom legends in Power bi?

I just need to move my legends in top left corner. But there is no option for that.
So is any way I can create maybe a table with one column color shape and the other column the description?
Something like that:
And then just use it as Legends for the chart?
Depending on your visual you have under the format tab a legend option. For example if you use a pie chart you can toggle the legend on or off. Also you can position the legend (top, top left, bottom, etc...).
The second way is to use a custom visual with your desired needs.
And the third way is, like you already stated, a table which acts as legend. Either you enter your legend text in a separate table manually or you use a query. For example a distinct count to get the unique values.

Apply different different data colors to different charts in power bi theme creation

I am using PowerBi February release.
I am trying to create custom theme (.json file). I want to have different data colors for different charts and not the global/common data colors for all charts.
Suppose for line chart colors are "red,green,blue" then for pie chart colors are different, lets say "yellow,grey,purple".
Can you please suggest how to create a theme based on above requirement.
Thanks in advance
Currently, this is not possible to create a custom theme that pre-assigns each color to a bar or piece of a pie chart. You can for KPI and some of the other visuals, but not pie or bar (aka stacked column chart)
The current workaround is very easy though. Follow these steps:
1) As suggested by this blog, create a custom theme with your desired colors. Using this online tool, I was able to make a minimum theme file from your requirements:
{
"name":"MyTheme1",
"dataColors":["#ff5624", "#21ff13", "#0009db", "#fff780", "#d3d3d3", "#7d00b6"]
}
2) Save this as yourtheme.json and import the file in the Ribbon using Themes->Switch Theme->Import Theme
3) Then you would need to go to the bar chart and pie visual and assign the colors individually:
For the Pie Chart - click the paint roller found in the visualizations pane and expand Data Colors. Then assign the color to the values for each pie piece. (see image for the colors from your theme.)
For bar chart (aka stacked column chart) click the paint roller found in the visualizations pane and expand Data Colors. Then set the Show All setting to On. Then assign the color to the values for each bar.
The image below is a power bi report with bar and pie charts colored with the colors from your imported theme file.

Displaying labels for grouped datasets in ChartJS clustered column graph

Not sure how to even define this question, so bear with me!
First, I want to display multiple unrelated datasets, side by side.
Second, for each dataset, I'd like to have column-based lables (default for each column), then an overall "grouped" label for the dataset.
I can "fake" the appearance of this chart by entering a "zero" column entry, creating the gap between the "datasets" I have (even though in ChartJS is just one dataset).
The text line one is default behaviour with ChartJS to display the column label. However getting a "grouped" label to appear is beating me! What I've ended up doing is generating the chart label-less, then doing some funky HTML hacks to get the labels back with the grouped text I need. This approach is not scalable.
Can anyone point me in the right direction for this? Doesn't have to be ChartJS powered.

Chart templates, color schemes and font sizes

I'm trying to automate some PowerPoint charts, but I'm having problems preserving some formatting.
When I add a chart using a chart template, the chart doesn't use the slides color scheme, but rather the colors it was saved with. It doesn't help to change the color scheme for the slide - the chart isn't updated. To make the chart update to the color scheme of the slide, I have to clear formatting for the chart. The problem with doing this is that all font sizes are automatically set to 18pt. I cannot find any easy way restore the font sizes for the chart without saving all sizes before calling clear, and set them back after clearing.
Have you looked into using the Format Painter function it may or may not work depending on a variety of factors from my quick look on the net (google it for lots of articles).
Also if you've done one chart you should be able to copy the formatting from one chart to another using the paste special option as mentioned here http://www.pcreview.co.uk/forums/there-format-painter-equivalent-use-many-charts-t3611646.html .