How to make the size of pie chart fixed without using canvas (chart.js) - angular5

I use Angular to make a website and on the website, there is a pie chart. I need to set the size of a pie chart (chart.js). Since I generate a pie chart dynamically, the number of labels of charts would vary. If the size of canvas is fixed, then when there are less labels, the size of chart becomes large; when there are more labels, the pie chart becomes small. Is there a way to make the size of pie chart fixed no matter how many labels I have? Thank you.

if I understood correctly, you can use maintainAspectRatio: false in options and then set the width and height via css/sass

Related

Can I wrap the legends or put the legends below the pie in react-native-chart-kit Pie Chart?

In my react-native-chart-kit pie chart, there will always be either absolutely no data (which I won't show the pie chart at all) or there are exactly two pieces of data. By default, the legends are showing to the right of the pie. The actual text in the legend is coming from the name properties in data. I have tried putting in a newline character (i.e. \n) but that didn't help. So, is there a way to wrap the text in the legends to show in two lines? Or can I change the position of the legend to right below the pie?

How to resize the legend label in Matplotlib Graph

I wish to resize the Population label seen in the legend, I want the circle to be smaller than it is right now. How do I do that ?
There are many ways to do this, but the easiest is to set the desired size in the legend. That size will be a manual setting.
plt.legend(markerscale=0.5)

vega-lite: how to dynamically resize single plots

I'm looking for a way to set the size on a chart either dynamically or at creation of a single vega-lite chart. So far, I have tried setting width and height on spec.config.cell used for trellis charts which sets the height only, also calling the width() and height() methods on the view object, e.g.
view.height(200).width(200).render()
best I can do is get the canvas to resize and crop the chart, but the chart does not redraw to the specified size. I'm looking for it to work with padding:'strict' to specify the overall size, not just the size of the data rect.
Aside from manually setting the bandWidth for ordinals it seems the feature isn't implemented just yet:
https://github.com/vega/vega-lite/issues/1356#issuecomment-231825910

Reduce the height of a telerik graph chart

I am creating a graph chart using telerik TChart. Using storyboard I set the position of a graphview.
For iPhone,it's height is correct for all values of chart but for Ipad if I give maximum value it will touch the above labels. so I have to reduce the height of that view of chart programmatically.
Is there any way to reduce the height of graph.If I want to set frame size height of graph using
_graphView.translatesAutoresizingMaskIntoConstraints
it will generate exception. so is there any other way to set height.

Dynamically creating multiple chart areas

I am creating a program which given some data files, creates charts based on these files. Rather than creating multiple charts, I have chosen to create multiple chart areas in a loop and add the various data to the chart areas. When using some sample data, which is small, the program creates 3 chart areas within a chart and works fine.
However using larger data, the program creates the chart areas but because there are over 10 chart areas to create, they do not fit into the size of the chart and also are aligned vertically rather than horizontally.
What I would like to do is increase the size of the chart fitting in all the chart areas for large data, aligning all the chart areas vertically and allowing the user to view all the chart areas via a scroll bar, since there will be a lot of chart areas using the real data files, any help will be appreciated.
The below are examples of alignment types you can switch to
Chart1.ChartAreas(0).AlignmentOrientation = AreaAlignmentOrientations.Horizontal
Chart1.ChartAreas(0).AlignmentOrientation = AreaAlignmentOrientations.Vertical
As for a scroll bar, the chart control doesn't support scroll bars. What I would do is have my original chart contained in some sort of panel/tab [any container that supports scroll bars] and then is number of charts required reaches a certain level add another chart below your original and then allow the container to build the scroll bar
'when charts required is now 5 create new chart
If Chart1.ChartAreas.Count =4 Then
Dim OverflowChart As New Chart
'add a new chart below your current chart and let the container
'have the scroll bar and not your chart control
End if
I managed to figure it soon after I posted here which is ironic. For the sake of anyone with similar problems in the future. The way I did it was to:
- Add a scrollbar to the form
- Make the blank chart as big as possible to fit whatever data which was going to be used
- Manually set the position of each chart area using ChartArea.Position and changing the posY for each chart in a loop
This worked great and gave me a lot of control as to how big I wanted the chart areas since ChartAreas.Position also has a width and height attribute and allowed me to easily align the chart areas horiziontally using the y coordinates of each chart area.