Aligning BIRT charts regardless of the legend size - charts

I have created a BIRT report with multiple charts.
All the charts include different data but for the same time span.
So i want to make the x axis of the charts align with each other so it is easy to read all the charts at once.
But the series names of these charts are different from each other.And some charts gets dynamic series names in which the length cannot be predicted.
Even though i align the charts with same width and height because of the series names the legend gets too lengthy and the alignment gets ruined.
According to the requirements given to me legend should be placed at the right side of the chart.
Is there a way to fix the size of the legend without truncating the series names.May be a way to wrap the series names so the size of the legend will be same for all the charts and the charts will be aligned nicely.

From your Eclipse designer:
Edit charts -> Format charts -> Legend -> Layout -> Wrapping width
Set a wrapping width value as expected, for example try 60.
You might also have to increase the bottom inset of legend entries to avoid overlapping:
Edit charts -> Format charts -> Legend -> Entries -> Bottom inset

From your Eclipse designer: set Format Chart->Legend->Entries->Ellipsis property to possible max length of your dynamic legends. and the problem will be solved.
As this property work as follows:
The default value is "1". Int attribute "Ellipsis" specifies the behavior of shortening the legend item's text with ellipsis if there is not enough space to display the whole text. Value 0 indicates that the feature is disabled, and the legend item will either be displayed with whole text or be dropped. A positive value n represents the minimal count of characters to be displayed before the ellipsis, which means the legend item will either be dropped or be displayed with at least n characters.
Hope this will solve your problem. It worked for me.

Related

Tableau: how to align text in dual axis-ed column labels

I am having trouble with label's text alignment. I used workaround to have rows coloured based on a value of certain row (featured in e.g. this tutorial); for example, if the Status is "Cancelled", it colours entire row red, otherwise it is green.
I created AGG(MAX(1)) columns for bar (with fixed range 0 to 1) and AGG(MAX(0)) columns for text (with fixed range 0 to 0), then paired them through dual axis.
However, I found out the text label is automatically aligned to the centre. I looked into text label options and set my alignment to the left (in both Edit Label window and Alignment setting) but it had no effect whatsoever. I changed Format... settings for column but once again, it had no effect.
I even tried changing fixed range on AGG(MAX(0)) columns or changing the zero in MAX(0) to some other number but this only moved centre-aligned text so it was of no use.
Here is a picture to illustrate my point:
I found out what was the issue and also arrived at better way to do it than the one I described in my question.
Here's the tutorial (using Tableau 2021.4):
Create a column MAX(-1). Right-click the column, go to Edit Axis..., set Range to fixed (start at -1, end at 0), delete the Title, and disable all Tick Marks (by setting them to 'None').
In Marks panel, set the Mark to 'Gantt Bar'.
Drop your condition for coloring (e.g. calculated field) on Color in Marks panel.
Create a calculated field MAX(1) and drop it on Size in Marks panel. This will fill out entire column width with a color bar. If needed, increase the bar width by moving the slider under Size to the right.
Drop the text value on Label in Marks panel. Now you should see text labels. If not, increase cell's height (Format > Cell Size > Taller or Ctrl+Up).
If you want a header (just like shown in my picture), create a column MAX(0), set its Range to fixed (start at 0, end at 0), disable all Tick Marks and change the Title.
Right-click the MAX(0) and tick 'Dual Axis'.
In case you'll encounter some challenges when formatting the end result, check formatting hierarchy (this tutorial may help).

jfreechart pie chart fixed pie radius

I have dynamic pie set and if there are a lot of series then pie get small.
How to set fixed pie chart radius.
A PiePlot grows to fill the space available, so you'll need to give it room to grow. Some possible approaches:
Override getPreferredSize() and use a suitable layout, as shown here among other suggestions.
Display the legend items in an adjacent component, as shown here, leaving the chart alone to fill it's container.
Reposition the legend within the chart, as shown here for the default RectangleEdge.BOTTOM.

Unwanted word wrapping in caption

In a FusionCharts (version 3.4.0) 2D Bar chart, I found that the caption wraps to a second line when the bar labels are long. How do I prevent it from doing this so that the caption appears on one line?
Check out this jsFiddle to reproduce the problem:
http://jsfiddle.net/eZjjT/163/
-
To prevent wrapping of caption text in horizontal bar charts, you can specify the maximum percentage of width for data labels along the X-axis, using the “maxLabelWidthPercent” attribute.

How can I get the size of the Plot Area in a Microsoft Chart Control

I am using the MS Chart Control in a Windows application.
I am charting various series dynamically and the user can specify which charttype each series should be. This leads to situations where pie charts are combined with line/spline charts etc..
When at least one series is specified to be a pie chart, I am dynamically adding chartareas and legends to give each of these series their own chartarea, while all the "basic" charttypes (line(area)/spline(area)/etc.) are combined into a single chartarea.
The issue is that when adding 10+ series where the majority are pie charts, the charts are resized so small, they become useless. My thought was to dynamically increase the size of the chart control (thereby increasing the size of all chartareas within). My issue is, the width and height of the InnerPlotPosition are always zero unless I set them explicitly.
Is there any way to determine the size of the Plotting Area in pixels or percentage (which I could multiply by the chart controls size to get pixels), etc. even if not explicitly set? This would allow me to increase the chart controls size until some minimum ( and hopefully, readable) value was reached.
I find that InnerPlotPosition is set at least in a PostPaint event callback. You may be checking that property before the Plot Area has been calculated.
This works:
var c = new Chart();
c.PostPaint += c_PostPaint;
// Do whatever to setup the chart
// Then in my case I'm saving the image which causes rendering
c.SaveImage(myFileName);
void c_PostPaint(object sender, ChartPaintEventArgs e)
{
var ipp = e.Chart.ChartAreas[0].InnerPlotPosition; // Values populated here
}

Jasper Reports, Expanding a Band Based on the Data in a Chart

Is there a way to get a band to resize based on the amount of data presented in a gantt chart? I can get the number of rows that are in the chart, if that helps. It seems like there should be a way around this.
In otherwords, how does one dynamically resize a chart in JasperReports?
The solution to this is to put a text band right beside the chart and estimate the appropriate height, use a scriptlet to generate enough text that would end up being close to the right height. On the text box, stretch on oversize, and the band will increase. Stretch the chart to the band height.