How to change .net chart width to %100 - c#

How can I set the width of an asp:chart to be 100% the width of the page?
The chart width attribute does not like percentages.
Another solution would be to check the current resolution, how to get that from .net?

You can try using the Request.Browser.ScreenPixelsWidth property.

Related

Get WPF control height when it is set 'Auto'

I need get a WPF control height for calculate my next control margin top, but when I try get control height with textbox1.height, this is return 'Auto' and not numbers
What can I do for get control height, when it is set 'Auto'?
You should try this:
textBox1.ActualHeight
Remarks (by #Viv)
just make sure when you query for textBox1.ActualHeight, you do it once the control is Loaded. You're going to get 0.0 if you check ActualHeight before it's setup properly

How to get a Grid column width in pixels in WPF?

Column widths are specified in different ways (Stars, Auto etc)
How to get the width in pixels of a specific column?
GridLength l=tip.basis.ColumnDefinitions[0].Width;
You can use the ActualWidth or ActualHeight property of elements to get the width/height of elements. This answer describes the difference between `'ActualWidth' and 'Width'.
So in the above example it would be:
Double width = tip.basis.ColumnDefinitions[0].ActualWidth;
And also keep in mind that WPF uses Device Independent Pixels, as described in this answer.
The ActualWidth property should provide the width of the column in Pixels
MSDN Page
Use the ActualWidth property to get the width. It represents
The width of the column in device-independent units (1/96th inch per
unit).

How to set autosize font in zedgraph

I'm using ZedGraph in my c# project.
My X axis has text labels (used for bar chart), but with the default setting of XAxis.Scale.IsPreventLabelOverlap = true every second label is missing. When I change it to false with XAxis.Scale.MajorStep = 1 every label is shown, but font size remains the same, and labels overlap.
Is there any way to change font size of labels ? or preferably switch it to autosize ?
I hate to let you know but as far as I know you cannot change the axis label font size directly. You can change the axis title font size, but not the labels themselves. You can change whether or not they autosize though and scale at which they autosize and it seems that is sort of what you want and that may end up helping you. This is the resource at which I was looking.
Set the PaneBase.IsFontsScaled property to true and then you can change the scale factor by using the PaneBase.ScaleFactor() method. Look through that resource I linked and I think you will be able to get it done. I don't have ZedGraph installed so I can't test it but I'm sure it will be something like that.
Good luck!
my solution is ;
curve.Label.FontSpec = zg1.GraphPane.Legend.FontSpec.Clone();
curve.Label.FontSpec.Size = 6;
I've forgotten about this question long ago.
I've found my own solution, which isn't so clean. I've rewritten the PaneBase.CalcScaleFactor() method by changing return scaleFactor; to something like return scaleFactor * 0.75f;. Now it works as it should.

MS Chart Width 100%

I am displaying Column Chart based on dynamic data. I want to set the Chart width 100%. But MS chart does not allow to set it. Please can you suggest me how to resolve this issue. Because I want to set Bar width same for all series.
Set your chart width to som larger number to allow clear rendering - say 1920px
Then add this bit of javascript to your page
setTimeout("document.getElementById('<%=Chart1.ClientID %>').style.width = '95%'", 500);

How to increase the height of combo box in asp.net

I have a drop down list in asp.net. I want to increase its height. please suggest, how to icrease it.
There is a height property on the drop down list.
myDropDown.Height = 200;
BTW: There is pleny of information around on how to do it:
http://dotnetslackers.com/Community/forums/asp.net-dropdownlist-item-height/p/3151/31235.aspx
http://www.vbforums.com/showthread.php?t=419074
http://forums.asp.net/t/1300753.aspx/1
If setting the height property is not helping you,
One way of achieving this by increasing the font of the dropdown as it gets set based on the height of its contents.
Or you could set it via css (not sure will work in all browsers)
Please edit to describe your current scenario with some code
Set the Height property of the control

Categories