MPAndroidChart - CombinedChart - First and last bars aren't visible completely - mpandroidchart

In CombinedChart by adding chart.setFitBars(true) will make the first and last bars visible.
I need to do the same for combining LineChart with BarChart.
Now, first and last bars aren't visible completely.
I've tried
xAxis.setAxisMaximum(data.getXMax() + 1f);
to extend X-Axis towards right side so that the last bar will get enough space. This did the trick.
But what should I do for left side bar?
setAxisMinimum doesn't help.
After adding setAxisMaximum :
EDIT
I've referred this but it gives the solution for only BarChart.

Got it.
xAxis.setAxisMinimum(-0.5f);
I guess, Edited X-Axis label will make it look good.
For editing labels in MPAndroidchart refer this answer

Related

Amcharts4 legend label not truncated when value is right aligned

I am creating a pie chart with the legend at the bottom. I have added the config to truncate the legend label by passing
chart.legend.labels.template.maxWidth = 120;
chart.legend.labels.template.truncate = true;
Works fine until i try to right align the value by passing
chart.legend.valueLabels.template.align = "right";
After adding this, the labels are not truncated and occupy the full width.
Any help on how to achieve both truncating and also having the values aligned to the right would be much appreciated. Also I could not find any adapter method to overwrite the label. If so, I can strip the label after certain characters and return.
Here is a codepen demo of the above mentioned issue.
It was an issue acknowledged by the amcharts team and it was fixed later.

Can you force a label on top of a bar chart in SQL Server Reporting Services?

I would like to ensure the labels of my bar chart are above the bars. Can you force a label on top of a bar chart in SQL Server Reporting Services? If so, how?
The issues are the colors are so dark, it's hard to read them if they are not above the bar in the chart. I could just change the colors, but I'd rather learn how to force the label location if possible.
I'd like all numbers to be above the bar, like over the blue bar below. I have over 100 different charts in my report, so the scale will vary greatly depending on the particular report.
Thank you!
In Visual Studio, design mode, ensure that the properties window is visible, then click on any of the labels on the chart.
At this point, the properties window should show the properties for Chart Series Label.
Find the 'Position' property, which probably is showing the value 'Auto', change this value to 'Top' and this should do the trick.
You have to first make sure the chart type is not stacked.
In my experience the "Position" property doesn't always work.
Sometimes you have to go to the properties of the series, then "Custom Attributes", then "Label Style" then select "Top".
What #niktrs said in the comments of the other answer about setting the AllowOutsidePlotArea property is also true.
Microsoft do not use the label Position property for some of the chart types.
They tell us what they use by default here - in your case "on bar charts labels are placed outside of the bars that represent data points" (they appear to mean "column charts")...but sometimes with a large value it's placed just inside, sometimes partially in-out (and if you try the "Outside" position it just fails to render!).
As #jayvee has mentioned the trick with Column charts is to select the value and change the SmartLabels AllowOutSidePlotArea to True (from Partial).
However if you have a Stacked Bar chart then labels are always in the centre of the particular value.
The hack to get labels on top is to add an extra Stacked Bar value with the Color set to "No Color" and move it to the top of the values (using the Chart Data designer arrows).
The trick is getting a good expression value to use - a constant ends up too big or too small at some point, so I found a percentage of the stacked values works best (remembering to change Nulls to Zeros)...25% to 30% usually works.
Then set the value Label to the value you want to display in the data label.
I just had this issue, I was able to fix it by making sure the chart series "Smart Labels" - "Disabled" property was set to "True"
This is what my properties pane looks like:

Why can't I set DataLabel.Position to xlLabelPositionCustom?

I am working with vb.net and excel 2007 to create some graphs for myself. I wanted to set the datalabel positions to a custom value since the default above position (xlLabelPositionAbove) causes the labels to clash with error bars and the default option for a side (such as xlLabelPositionRight) may leave the label over another point or other errorbar. Due to this, I wanted to set the label to a custom position where it is off to about a 45 degree angle to the top right (like right in the middle of where the default above and right positions would place it).
I tried doing this by adjusting xlMySeries.Points(index).DataLabel.Top and xlMySeries.Points(index).DataLabel.Left at first, however I ran into an undescriptive error leading me to believe I was not doing things correctly. I then thought to try setting xlMySeries.DataLabels.Position = xlLabelPositionCustom and then adjusting top and left. However, to my surprise, I could not even change xlMySeries.DataLabels.Position to xlLabelPositionCustom!
Whenever I try to adjust top, left, or the position to certain datalabel positions, I get HRESULT: 0x80004005 (E_FAIL), which I have generally found to mean "You are doing it wrong" in my experience so far with excel. I cannot set the position member to custom, or anything other than just above, left, right, center (so not bestfit, custom, or any inside___ one)
Any idea why I cannot set the position property to what I need it or otherwise change the position of my datalabels? I just need SOME way to adjust the positioning of my datalabels to a custom psoition (or position other than above, left, right, center, bottum). Thanks in advance!
You can set positions only to whose which you can see on the Data Label properties window.

Empty pages in RDLC-Report

I have a rdlc report that conains a tablix, nothing other. The Tablix expands in horizontal direction to show days and in the vertical direction to show groups.
The tablix works as expected, as long as I set the width of the content area equal to the width of the tablix.
If I expand the content size to its fixed size (approximately PageWidth-PageBorders) and run the report, every second page is an empty page.
However the tablix only uses one page. Every odd page is absolutely empty. It seems that the tablix adds its horizontal expansion to the currently definied content width and calculates then the overflow.
The reportviewer Version is 3 (2010 Redistributable)
Does someone have a solution for this odd behaviour?
Update
If I export the report to excel, I see that there is on the right site of the tablix a column that is exactly as long as the generated items for the days. It seems realy to be a bug or a feature I don't see how to deactivate.
I also have tried to create the same construction from a table, and it resulted in the same problem, what not is astonishing, because the table is internally also a tablix.
Update 1
If I set the property "ConsumeContainerWhitespace" of the report to true, the above test version works. But if I place then other elements in the "white" area, the effect reocurrs.
Setting the page-property ConsumeContainerWhitespace=true (in the properties dialog, F4) has helped. However it was anyhow tricky to build the report correct. At the begining it worked only if I added all extra content to the page-header and footer. But this was not acceptable. After a lot of trying, I succeed in making the report as desired. However I don't really understand the logic behind.
I have in mind that I already have done such reports (growing in both directions, horizontally and vertically together) without any problems and I don't know what is difference to this report here. For this report, it's definitively reproducable that the ConsumeContainerWhitespace-property makes the difference. But why this never happens to me for similar reports I have done, I don't know. Also I don't know why I had first to circle around before the layout-engine accepted my design.
The best way to solved this problem is, for example for an A4 page where
Width=21 cm and Height=29.7 cm
Now Margin Left=1 cm and Right=1 cm so you are having a usable width of 19 cm.
When you have understand this basic calculation that means your problem is solved. You can set up the report page size properties by right clicking on the report property => pagesetup.
I was working with an RDLC report that was printing an extra blank page. I tried all the usual tricks, and everything I could think of, until I realized the problem was caused by an extra amount of visible whitespace in the right margin area of the report. One of the objects in the report (a "Rectangle") was a single pixel or two too wide, and this prevented resizing the visible space of the report. Once I removed all the extra width, the report started printing with the expected number of pages.
Visual Studio 2017 (15.7.5) + Microsoft Rdlc Report Designer extension (v14.2)
I had a similar problem, I solved it this way
For instance for width, the following equation should be satisfied
PageSize >= LeftMargin + BodySize + RightMargin
where to find BodySize?
Press F4 -> CLick somewhere inside the report -> you will find body property(look at size property, take the width value)
Where to find report PageSize?
click somewhere outside the report -> you will find report property ( look at PageSize (take its width value), and margins (Left, right, ..), take left and right margin values)
take values from these properties, and check if they meet
PageSize >= LeftMargin + BodySize + RightMargin
Check the "body" size, try to make it as wide and height as your real paper size but reduce only the margins.
There is a confusion there on the page design. Developers would think the report being designed is WYSIWYG, but actually it's NOT!! Microsoft reportviewer will take your designed page as the content!! and append the margins defined on the outside of your page, and turn out that your page can never fit in to one page!!
So, when you design a new report, focus on the content area, the client area, including your headers and footers, and allow margins to be appended on your outer border.
the solution is simple ConsumeContainerWhiteSpace=True (you find this in the property window for "report") you set the paper size in the main menu/ report/report properties for example to "A4" and then you check that paper size is larger then body + header + footer + margins.
I was having the same issue until I played with the report body's height and width. :)
Please select "Report" in the object selector at the top of the window.
and make the ConsumeContainerWhiteSpace = true
if the also same problem persist then, your rdlc report size should be less than your report body.!
I have meet this problem recently.
The root cause may be:
your report's body has some blank upside report Footer or somewhere else.
The solution is :
1, click the report body
2, go to the property window, you will see the body size property
3, check the body size, you may find a strange number like 9.6654in,1.5625in.
that means you have some blank upside the Footer, modify the height or width size till there is no blank you can see.
Go to Property F4
Select Body
Write width and height to 1cm
Visual studio will overwrite to the smallest Body possible
Done.
You need set report width property to actual print page width. In my case 6 inches helped.
You need to make sure your RDLC Report have :
ConsumeContainerWhiteSpace = true (open by click F4)
Report Body Size <= Page Size+margin Size. (open by Ctrl + Alt + D)
Page Footer may cause the problem too. So if you have one, it's better to place it as near as possible to the main content. In this case you don't need to set the Body.Height property.
My 4x2 inch label was printing 3 extra pages for a one page report.
To fix it, I reduced the Body.Size attribute to be same or smaller than the Report.PageSize minus the summed respective Report.Margins.
Try this one,
Just make sure that all Data the needed is in the report,
Then Select the Table or the Matrix and make it squeeze to the left and if needed to the Top Left Corner until your white Page Problem is Done.
But make sure that the cells are squeezed in the right manner, Be gentle (I hope you got it !!)
Ok, Bye
Or you can just graphically resize your report design, to the exact bottom of the last report control or label.
Or add a footer section to create some space.
I thought this important enough to put here, especially since every day more of the critical information we need to do our jobs keeps disappearing:
From response to The "Every Other Page Is Blank" Feature
Many Reporting Services users ask this question:
"I'm rendering to a physical page format (PDF, Image, Print) and for
some reason a blank page gets inserted between all of the other pages
in the report. Thank you, Reporting Services, for the free pages.
It's a charming feature, but paper ain't free and I'm getting paper
cuts pulling out every other blank page after it's printed. How do I
make it stop?!"
To which I reply:
This is almost always caused by the Body of your report being too wide
for your page. Make sure that the Width of the Body is less than the
physical page size, less the margins. For those of you who are into
the math thing, make sure that:
Body Width <= Page Width - (Left Margin + Right Margin)
For physical page renderers, it's important to keep in mind the
concept of Usable Area. The Usable Area is the amount of space left
on a page for your report to be drawn after reserving space for
margins, headers and footers, and column spacing (for multi-column
reports).
Horizontal usable area:
X = Page.Width - (Left Margin + Right Margin + Column Spacing)
Vertical usable area:
Y = Page.Height - (Top Margin + Bottom Margin + Header Height + Footer
Height)
Any time objects on your report (including the Body itself) extend
past the usable area either because they are defined like that or
because they grow at runtime, the physical page renderers have no
choice but to break onto a new page.
Make sure Body size is cm , not in(inch)
For me when I increase the width for pagesize report from 21 to 23 cm , It was not generating extra empty page.
Because of few elements total size of my report's element was greater than 21 and less than 23, that is why I changed to 23cm and works for me.
In my case I have only one page and I was working with .rdl file.

MS Access Draw line around detail section that can grow

This really shouldn't be hard, I just can't figure out how to do it.
I am making a proposal report that needs to have a border around it. The problem is to get the vertical lines on the side. I can't figure out how to get a line to grow and shrink based on the height of the detail section.
I have used Crystal reports and sure wish Microsoft would learn a few things in regards to MS Access report writing!
I am very comfortable with VBA so have no fears there.
You were right, this isn't so hard. The trick is to use 2 variables, top and bottom. In the PageHeader_Format event you set top to Me.Height, and in the PageFooter_Format event you set the bottom to Me.Top - correction, where correction is a fixed amound you use to fix the right length. I´m not sure where this amount comes from, you just have to try a little bit.
In the Report_Page event you can then draw your line from top to bottom.
Another method that nobody has mentioned is the one using the Line method of the report, outlined in Knowledge Base article 210321. I've used this one for years, and it can be used to draw both lines and rectangles. It's quite handy for invoices that have variable height subreports for the invoice details, but need the vertical lines to change according to the height of the main report detail.
No VBA needed.
Make a dummy grouping that is unique to each detail. For that grouping, set footer to yes.
In your new group footer section that you just created, add your line.
In your detail section, select all the relevant fields that can grow and set Can Grow = Yes
Done!
Edit
Off-topic, I agree that Access Reports could learn a lesson or two from Crystal. But Crystal isn't perfect either. [/flamewar]
Try this one.
Right click on the detail bar and select properties. Set the special effect to “Sunken”. This will put kind of a border around the detail section that resizes with the detail section.
I have tried to get a line to dynamically resize but its catch 22, by the time you know the height of the section (In the On Print event) you cant make any changes!
use the page event coupled with me.line and scaleheight / scalewidth.
I draw a box around the whole page with the following. Play with it and see where you end up. It is very handy for making professional reports. If you want a line in a certain place on a report you can use the controls coordinates. like
me.line(Mycontrol.left,mycontrol.top) - (myothercontrol.left+myothercontrol.width, myother control.top + myothercontrol.height)
Private Sub Report_Page()
Me.Line (0, 0)-(scalewidth -30, scaleheight-30), 0, B
End Sub