Establish Itext table width using SetWidthPercentage method in VB net - vb.net

I have a table which I need to fill 100% of the whole page. This is the code I used:
....
Dim tamanyo_tabla As New Rectangle(PageSize.A4)
Dim dimensiones_tabla(11) As Single
dimensiones_tabla(0) = 3
dimensiones_tabla(1) = 3
dimensiones_tabla(2) = 10
dimensiones_tabla(3) = 10
dimensiones_tabla(4) = 10
dimensiones_tabla(5) = 8.33
dimensiones_tabla(6) = 8.33
dimensiones_tabla(7) = 12.5
dimensiones_tabla(8) = 8.33
dimensiones_tabla(9) = 8.33
dimensiones_tabla(10) = 6
dimensiones_tabla(11) = 12.18
table_sem.SetWidthPercentage(dimensiones_tabla, tamanyo_tabla)
....
If you sum all the figures from the array dimensiones_tabla you will notice its 100%.
I based this on this example(it has no updates, eventhough the method has changed): http://itextpdf.com/examples/iia.php?id=79
I open the pdf and I found the table width is far from being 100% of the page.

You are setting the width percentage like this:
table_sem.SetWidthPercentage(dimensiones_tabla, tamanyo_tabla)
The total of all the widths in dimensiones_tabla is 100 user units (1.3889 inch). The width of tamanyo_tabla is 595 user units. Hence you are defining a width percentage of 100 / 595 = 16.8%. 16.8% is indeed far from being 100% of the page.
If you want the table to take 100% of the available width of the page, why don't you just set the width percentage to 100%?
table_sem.setWidthPercentage(100); // Java!
In VB, this would probably look like this:
table_sem.WidthPercentage = 100 // VB
Note that this will not be 100% of the total page, because you probably have a left and a right margin that is greater than 0. If you want the table to cover the complete page width, you need to set the left and right margin to 0.

Related

add horizontal Line in existing Trend Indicator

I am using the MTrendSqueeze Indicator which is based on a simple moving average value.
I want TradingView to draw a line, once this condition is met:
Barclose divided through current trend indicator value = 50 or less
That means in the example picture it would be:
4,89 / 0.2 = 24,45
It´s less than 50, so draw a line there
MTrend example

VB2010 Setting logarithmic scale intervals

I'm developing a financial application in which I need to display data in a chart with a logarithmic scale on the Y axis. Everything works fine except for the intervals. With the following:
chart.ChartAreas(0).AxisY.IsLogarithmic = True
chart.ChartAreas(0).AxisY.LogarithmBase = 10
chart.ChartAreas(0).AxisY.Interval = 1
chart.ChartAreas(0).AxisY.Minimum = CalcMinYVal(minYVal)
I get the CalcMinYVal multiplied by 10^0,10^1,10^2,10^3 and so on for the Y-axis values.
I would like to have the Y axis values increased by 1. How can I have the interval be REALLY 1?
You can enable the MinorGrid property
chart.ChartAreas(0).AxisY.MinorGrid = True
to show the horizontal lines in between the powers of 10 like shown below.
But there is a limitation in showing the value for each subdivision. They can only appear in fixed intervals by using the Interval property of the LabelStyle.
For example to show 10 subdivisions, you can set:
Chart.ChartAreas(0).AxisY.LabelStyle.Interval = 0.1
The number of the horizontal lines of the MinorGrid can be controlled by using its Interval propery:
Chart.ChartAreas(0).AxisY.MinorGrid.Interval = 1
and the values of the labels can be rounded by using the format property:
Chart.ChartAreas(0).AxisY.LabelStyle.Format = "{0.0}"

kendo-ui slider different steps for the first range

I'm using a Kendo-UI slider to allow the user to dynamically select a specific percentage. Selecting 0% makes no sense in my particular application. The problem is that I need the slider to show the ticks on multiple of 10 values (except on the first value/tick). In order to achieve this I need to set the minimum value to 0 and have the large step from 10 to 10:
#(Html.Kendo().Slider()
.Name("sliderPercentage")
.DragHandleTitle("Select")
.Min(0)
.Max(100)
.SmallStep(1)
.LargeStep(10)
.Value(80)
.HtmlAttributes(new { style = "width:500px;" })
)
This however allows the user to select the 0% value which can be confusing. What I really need is a way of setting the minimum value to 1 and the first large step to 9, so that the ticks are shown like this: 1 10 20 30 40 50 60 70 80 90 100. How can I achieve this?

Core Animation - How to calculate duration so that two lines of different length are drawn at the same rate

I have two lines at different lengths
Line1 -----
Line2 -------------
How can I calculate the animation duration for each line so that they both are drawn at the same speed.
At the moment, I have a set value for duration
line1.duration = 1;
line2.duration = 1;
Because of the different lengths, line1's animation is slower than line2.
How can I calculate the animation duration with a fixed speed?
EDIT
Forgot to mention that line1 doesn't know line2's length as the lines are drawn in a loop. What i'm after is a constant velocity calculation / pixels per seconds
Try this:
line2.duration = lengthOfLine2 / lengthOfLine1 * line1.duration;
(substitute the appropriate values.)
I am assuming: Drawing at same rate - You mean both of them should end drawing simultaneously.
Suppose Line 1 : Length - 100 px
Suppose Line 2 : Length - 350 px
Then suppose 1 px takes 1 ms then Line 1 will take 100 ms
For Line 2 to take 100 ms it needs to draw (350/100 = 3.5 px/ms)
So suppose Short line takes time "t" for line of length "l1"
Then greater line should take time "l2/t" for line of length "l2"
for both of them to stop drawing simultaneously.

What is the "star" measurement in Expression Blend?

I am currently working on a Windows 8 Metro/Modern UI application. Right now, I'm working on the interface in Expression Blend for Visual Studio.
My question is this: When sizing UI elements such as grid columns, I can use either pixels, auto, or stars. What is a star in this context? A google search turns up nothing and I haven't found anything in the Windiws 8 developer documentation.
Thank you.
In a grid a * means that it will equally share available space with other * columns (or rows). There are some good WPF examples of how this works here.
From the documentation here:
starSizing
A convention by which you can size rows or columns to take
the remaining available space in a Grid. A star sizing always includes
the asterisk character (), and optionally precedes the asterisk with
an integer value that specifies a weighted factor versus other
possible star sizings (for example, 3). For more information about
star sizing, see Grid.
In a grid with multiple columns, the * size columns divide up the remaining space. For example assume a 300px wide grid with 3 columns (150px, 120px and 1*).
The calculation is:
remainder = (300 - 150 - 120)
Since the remainder is 30px the 1* column is 30px wide
Now add some columns and modify the widths to (35px, 85px, 2*, 1*, 3*)
Redoing the calculation:
remainder = (300 - 35 - 85)
In this scenario the remainder is 180px, so each * column splits the remaining pixels according to their weighting number.
factor = (180/ (2 + 1 + 3))
factor = 30px
Therefore the 2* column is 60px, the 1* column is 30px and the 3* column is 90px
300 == 35 + 85 + 60 + 30 + 90
Of course the same principles apply for Row sizing.
When the grid is resized the * columns divvy up the new remainder size. But they keep the same size ratio between other * size items. In the example the 3* column will always be 3 times as wide as the 1* column.