I have used 2 versions of charts.js on my HTML page. First I used v2, then I realized there is no offset property for the pie chart in v2, so I also used v3 for that pie chart. First I declared v2 charts.js for my other charts and then I declared the script file for v3 and then the pie chart. It works correctly, except for the fact that I have a dark mode toggle on my website.
How do I change the label colors for both versions of charts with my dark mode toggle? Please help.
Right now, I am only able to change the color for version 3 of the charts.js pie chart.
Related
I am using Chart.js version 2.7.2 to create a simple, single series bar chart. I want every bar in the chart to fill all available space such that each bar in the chart "touches" its neighbor(s).
My research has indicated that I should be using the barPercentage and categoryPercentage settings, setting both to 1. I've done this and it makes the bars very wide, but it leaves a single pixel gap between them.
My initial assumption is that this was due to a grid line, but even if I turn off grid lines (gridLines.display: false) it still has the one-pixel gap.
JsFiddle
Here is a screenshot. See the gap between each bar? How do I get rid of that?
You will have to update to 2.8+ version of the library.
There were multiple instances of issues around this on their GitHub (i.e. [BUG] Spacing between vertical bars with percentages set to 1 and [BUG] Small gap between bars even with barPercentage and categoryPercentage set to 1).
There was a PR that made it into their 2.8.0 version that is supposed to fix the issues around this (as noted by #benmccann at the bottom of the PR page).
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.
i plotted shiny Gantt-chart as per my requirement,
we require some interactive way for Display shiny gantt chart which is linked with one table view.
also currently gantt chart seems hover when we hover begin or end if task,
we are looking for output when anywhere click on task bar.
please suggest me how can we do this.
thanks
I'm creating a html5 web for mobile device and I'm using graphael to create a pie chart.
The chart is render perfectly but I have two problems that I don't found the solution.
I want that the first portion of the chart start at 12 oclock.
https://dl.dropbox.com/u/23287638/piechart.png
And my second problem its' that I want to have a line label for each portion of the chart like this:
https://dl.dropbox.com/u/23287638/chart2.png
Any suggestion to how to do this two things?
Thanks
Is it possible to change color and font size of default pie labels (in this simple example: "Hello" and "World") in Google Image Charts API? I've searched the documentation but I can't figure out how to do it...
Example code:
https://chart.googleapis.com/chart?cht=p3&chd=t:60,40&chs=250x100&chl=Hello|World
https://chart.googleapis.com/chart?cht=p3&chd=t:60,40&chs=250x100&chl=Hello|World&chxs=0,008000,16&chxt=x
You define chxt=x
Then you set the color using chxs in this format
chxs=0,{color_code},{font-size}