how do i capture the legend shape in google pie charts using jquery? - angularjs

I am new to angularjs,i made a donut pie chart using google charts now i want to change the legend shape because default shape is circle but i needed square.
google chart append all code for pie charts on load when page render in browser ,so how can i capture the element for legend shape using jquery and change it from circle to square.The element for legend is really down in hierarchy inside the main div so how its possible.
my html for pie charts:
<div class="chart-container">
<div class="chart-title" style="padding-right:7em;">Total Calls</div>
<div google-chart chart="data"></div>
</div>
you can see in snapshot that how google chart append the pie chart inside my html.Inside svg element there is a g element and that g have some other g elements and first g is for legends.
any guide thanks

Related

Custome legend for antd pie chart

currently, I have a pie chart which is display the data like this
(https://i.stack.imgur.com/E1geb.png)
this is my config now
(https://i.stack.imgur.com/61cP6.png)
what I want is to display the value of each piece next to label

Anychart donut chart does not put legend to the right

I am using Anychart to generate a donut chart on a test website. I have the following code in my web page:
<div id="container" style="width: 500px; height: 400px;">
<script language="javascript">
var data = anychart.data.set([
['aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', 34],
['bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb', 21],
['cccccccccccccccccccccccccccccccccccccccc', 15],
['dddddddddddddddddddddddddddddddddddddddd', 11],
['eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee', 6],
['ffffffffffffffffffffffffffffffffffffffff', 13]]);
// create a pie chart with the data
var chart = anychart.pie(data)
// set the chart radius making a donut chart
chart.innerRadius('55%');
// set the position of labels
chart.labels().position('outside');
//chart.legend().position('right').itemsLayout('vertical');
chart.title('')
chart.container('container');
chart.draw();
</script>
</div>
This generates a nice donut chart but the legends are generated at the bottom of the chart with right and left arrows so the user can scroll through the legend.
When I uncomment the chart.legend().position('right').itemsLayout('vertical') command, the legends get generated to the right of the chart, but the chart disappears. Here is a screen print of the before and after.
Any idea on how to get the legend to appear to the right of the donut? Eventually, I will be using this to dynamically generate the chart so there is the possibility of being up to 50 data points.
Thank you.
It is expected behavior because the legend items have very long text. To solve the issue you should limit the legend width to provide more space for the chart itself. Simply add the line below:
chart.legend().width('30%').padding(0);
You can adjust the desired width in percents or pixels .width(100);.

Seek a react-plotly.js event handler example

I use React & react-plotly.js component (https://github.com/plotly/react-plotly.js) to plot two charts.
Since these two charts share some of the legend name.(like before and after comparsion charts)
I would like them to response the same double click legend event (double click legend will show only that legend data on charts)
There is document in here: https://github.com/plotly/react-plotly.js/#event-handler-props
But is there any example for me to learn and get started?

How to create multilines legend in Data Studio

In Data Studio my 10 points pie chart is like below:
As you can see there is a navigation arrow in the legend at the top of the pie.
I wonder how can I avoid the navigation by creating the multiline legend? How can I wrap the current single line legend?
Three ways to display all items in the legend; located in the Style Tab of the Pie Chart (added a GIF to elaborate):
Increasing the max lines;
Increasing the width of the Pie Chart;
Reducing the font size of the legend.
EDIT: Multi line Legend (Workaround using a Bar Chart)
How about using the legend from a Bar Chart? Added a GIF to elaborate as well as a few points:
Bar Chart: Use a Dimension and Breakdown Dimension that's the same as the one on the Pie Chart and enable the legend (Top) as well as using 2 lines (no legend for the Pie Chart)
Shape: Add a Shape over the Bar Chart (one that blends in with the background)
Order: Right click on components and select Order from the drop down to change the order of the components (Bar Chart: Send to back; Shape: Send Backwards (behind the Pie Chart); Pie Chart: Bring to Front)
Fine Tuning: Use Shift + Movement for precision placement (to get the shape exactly where you want it)

Add Start up animation on Pie chart using angular-nvd3 chart library

I need to add Start up animation on Pie chart in angular-nvd3 chart library , it is possible to add animation to some parts but I could not set animation for pie chart .
here is sample code http://plnkr.co/edit/vtKWU0?p=preview

Resources