Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

xmChart scaling issues

Featured Replies

Hi all:

I'm working on a solution using xmChart, which I've used a number of times before. However, I am trying to force xmChart to produce pie charts where the pie is always the same size. What normally happens is that the chart as a whole is a set size and, depending on the length of the labels, the pie in the middle is smaller or larger. I am currently working an a very elaborate algorithm to calculate the lengths and positions of all the labels, in order to set the chart to the right size. Has anyone done anything like this before?

Really, I'm just trying to save myself some work.

-Stanley

Hey stanley,

I made an interface file to give the user control of most of the different options, like size, colors, PieChartOptions, what the labels are and how they are displayed. The data string is sent to the interface file by whichever database groups the data, then the interface file lets the user customize the chart.

But I think your algorithm for scaling by length of the labels is a reasonable approach. I do a similar thing (setting the default chart dimensions) based on the number of series in bar charts.

  • Author

Ender:

Thanks for the input. Unfortunately, the solution I'm working on involves batch-processing hundreds of reports at once and printing them out, so there's no point giving the user control over the appearance of the chart.

Back to the crazy mathematics.

-Stanley

Stanley, Congrats on 700!

  • Author

Thanks Ender - I can't tell you how happy I am to be an "old hand" rather than an "addict."

  • 2 months later...

I'm quite new with xmChart, but... would it make any difference if you were to draw the graphic pie portion in one chart and the labels separately, in another, overlaying them?

Chris

  • Author

Overlaying doesn't work for a number of reasons. The solution I came up with was to concatenate the labels to a specific length and also to put a carriage return into them, in order to control the width of the labels. This gave me a result where all the pies (in a system with about 5000 records) were within 5% of each other in size, which was good enough.

-Stanley

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.