ZedGraph doesn't print real values - label

I'm using Zedgraph and I've a problem with values printed beside axis.
When my curve has values between 0 and 1000, no problem. But when I have values between 10 000 and 100 000 for example, Zedgraph prints 10 to 100 instead of 10 000 to 100 000 (or 1e4 to 1e5, I don't care).
Do you know which option can I change to have 10 000 to 100 000 instead of 10 to 100 ?
I've looked on scale.format property, it doesn't work.
One thing mode, when I use the contextmenu option "see values" the values printed near my cursor are good, so it's not a problem of wrong value saved by Zedgraph.
Thanks
Alex

yAxis.Scale.Mag = 0;
See Zedgraph-Documentation (API):
This (Mag) is used to limit the size of the displayed value labels. For example, if the value is really 2000000, then the graph will display 2000 with a 10^3 magnitude multiplier. This value can be determined automatically depending on the state of MagAuto. If this value is set manually by the user, then MagAuto will also be set to false.

Related

SQL Server Reporting: How calculate value based on the previous calculated value int the same column?

I'm trying to calculate a row value based on the previous row value in the same column within a report expression. I can't precalculate this from database since starting point of calculation is dependent from input parameters and values in a table should be recalculated dynamically within report itself.
In Excel analogical data and formula look like as it is shown below (starting point is always 100):
B C D E
Price PreviousPrice CalcValue Formula
1 NULL NULL 100
2 2.6 2.5 104 B2/C2*D1
3 2.55 2.6 102 B3/C3*D2
4 2.6 2.55 104 B4/C4*D3
5 2.625 2.6 105 B5/C5*D4
6 2.65 2.625 106 B6/C6*D5
7 2.675 2.65 107 B7/C7*D6
I tried to calculate expected values ("CalcValue" is the name of column where expression is set) like this:
=Fields!Price.Value/ PreviousPrice.Value * Previous(reportitems("CalcValue").Value))
but got an error "Aggregate functions can be used only on report items contained in page headers and footers"
Can you please advice whether expected result is achievable in my case and suggest a solution?
Thank you in advance!
Sadly I'm still facing with issue: calculated column does not consider previous calculated value. E.g., I added CalcVal field with 100 as default and tried to calculate using above approach, like: =previous(runningValue(Fields!CalcVal.Value, sum, "DataSet1") ) * Fields!Price.Value/Fields!PreviousPrice.Value.
But in this case it always multiples Fields!Price.Value/Fields!PreviousPrice.Value by 100..
For example CalcVal on Fly always show 200
=previous(runningValue(Fields!CalcVal.Value, sum, "DataSet1")) * 2
https://imgur.com/Wtg3Wsg
I tried with your sample data, here is how I achieved the results
Formula to use, You might have to take care of null values
=Fields!Price.Value/(Fields!PreviousPrice.Value*Previous(Fields!CalcValue.Value))
Edit: Update to answer after Op's comment
CalcValue is caluated with below formula i.e on the fly
=RunningValue(CountDistinct("Tablix6"),Count,"Tablix6"*100
and then Final value as below
=Fields!Price.Value/(Fields!PreviousPrice.Value*
Previous(RunningValue(CountDistinct("Tablix6"),Count,"Tablix6"))*100)

Sum or Percentage of a word in the results / column

I have a report that in part is providing: Job Date, Job Target Date and Completion date.
I have a column at the end that works out whether or not the job was completed within the target time our outside of returning true or false.
As mentioned, I have created a column to work out whether a job is completed on time and I have tried googling many different solutions and trying them out.
The expression I've used to work out whether the job was completed on time is:
=IIF(Fields!CompletedDate.Value <= Fields!Target.Value, "True", "False")
Now I need an expression to work out the percentage that are within the target. So, let's say there are 80 jobs and 67 are completed in time. It would be 'True' (67) / 80 *100 = 83%.
The expression I've used to work out whether the job was completed on time is:
=IIF(Fields!CompletedDate.Value <= Fields!Target.Value, "True", "False")
Now I need an expression to work out the percentage that are within the target. So, let's say there are 80 jobs and 67 are completed in time. It would be 'True' (67) / 80 *100 = 83%.
I figured this one out myself, again..
If anyone is interested I kept the same IF statement in the original cell. I then created 2 additional cells underneath one containing the text 'Percentage of jobs completed on target' and the other cell I added a new expression that included the original one above;
=SUM(IIF(Fields!CompletedDate.Value <= Fields!Target.Value, 1, 0)) / count(Fields!PropertyCode.Value)
All I had to keep in mind was that I am already showing the results as true and false so in my seconds expression I change the values to numbers so I can calculate. True is '1' so I know that it will not be calculating on 0 as it cannot divide by zero.
So, I did a sum on the number true represented as 1 divided by number of results. Rather than times this by 100 ( 5/19*100 = percentage), I simply left out the times and changed the format of that cell to percentage so it takes the value in the cell and returns the percentage.
Thanks,
Jordan

how to make sure to never get ora-01438: value larger than specified precision allowed for this column?

I'm doing a division for each record and updating a certain column with the result
so my sql looks something like this
update table1 set frequency = num/denom where id>XXX
my frequency data type is number(10,10)
Based on https://docs.oracle.com/cd/B28359_01/server.111/b28318/datatype.htm#CNCPT1838
First, I'm not even sure why I get this data because the answer will always be 0.XXX, so giving 10 before the comma would be a plenty. Then the 10 after the comma should be okay too because it will truncate if the answer is bigger.
NUMBER(10, 10) means 10 digits and a scale of 10.
That means you have 10 digits right of the decimal point which means no digit left of it.
So having the table
CREATE TABLE t
(
test NUMBER (10, 10)
);
insert into t values (0.9999999999); will work, while
insert into t values (0.99999999999);will fail because the value is rounded up to 1.
So if num/denom is 1 or even larger you will get ORA-01438: value larger than specified precision allowed for this column.
But you will also get this error, if num/denom is larger then 0.99999999995 as oracle tries to round it to 1.
First of all, let me get this confusion around the precision and scale cleared out. According to the documentation, it is stated:
For numeric columns, you can specify the column as:
column_name NUMBER
Optionally, you can also specify a precision
(total number of digits) and scale (number of digits to the right of
the decimal point):
column_name NUMBER (precision, scale)
In your case:
frequency NUMBER(10,10)
This means, that the total number of digits is 10 and this means that the column can accommodate values from:
0.0000000001
to:
9999999999
This includes Integers up to 9999999999 (10 nines) and floats from 0.0000000001 (9 zeroes and a 1 at the end).
Now that we know this, let's proceed to the problem..
You need this query to never fail with ORA-01438:
update table1 set frequency = num/denom where id>XXX;
You can do the following check, on update time:
update table1
set frequency = CASE LENGTH(TRUNC(num/denom)) >=10
THEN TRUNC(num/denom, 10)
ELSE
ROUND(num/denom), 10 - LENGTH(TRUNC(num/denom))) --TRUNC
END
where id>XXX;
What this would do is check:
1. If the whole part of the division is more than or equal to 10; in that case, return only the first 10 digits (TRUNCATE).
2. If the whole part is less than 10; in that case ROUND the result to "10 - LENGTH_OF_WHOLE_PART" decimal places, but still within the precision of 10, which is the one of the column.
*Note: The ROUND above will actually ROUND the result, giving you an inaccurate value. If you need to get a raw truncation of the result, use TRUNCATE instead of ROUND above!
Cheers

re sizing column data with tcl

I have a set of data that has a X number of points and I want to re size this to x+n number of points.
I need to do this with tcl and am struggling in the last part.
I know the Max, Min and the delta that is needed to refit the data to desired number of points.
Original data:
-0.3925
-0.262
-0.1965
-0.026
-0.013
-0.0065
-0.0026
0
0.0026
0.0065
0.013
0.026
0.1965
0.262
0.3925
I'm struggling to construct a for loop that will, take the first value and subtract it from delta to create the second value. Subsequently take the second and subtract it from delta to create third and so on and so forth.
Given:
Points 19
Min : -0.3925
Max :0.3925
Delta : 0.04361
Results column data would look like:
-0.3925
-0.348888889
-0.305277778
-0.261666667
-0.218055556
-0.174444444
-0.130833333
-0.087222222
-0.043611111
-6.93889E-17
0.043611111
0.087222222
0.130833333
0.174444444
0.218055556
0.261666667
0.305277778
0.348888889
0.3925
Could someone kindly give me some advice.
There are a few key points when doing this sort of thing (and these apply to languages other than Tcl too). Firstly, you should compute the delta from the span you want and the number of steps you want. Secondly, you should keep your incrementing and loop control using integers if you can, so as to avoid fencepost errors caused by rounding; instead compute the value for the loop iteration by multiplying the delta by the loop counter and adding to the originating value. Thirdly, you should consider what the right precision is when printing your results; in Tcl, this tends to mean using format with the %f conversion and appropriate width specifier.
set from -0.3925
set to 0.3925
set points 19
set delta [expr {($to-$from) / double($points-1)}]
for {set i 0} {$i<$points} {incr i} {
set x [expr {$from + $i*$delta}]
puts [format "%.5f" $x]
}
This produces this output:
-0.39250
-0.34889
-0.30528
-0.26167
-0.21806
-0.17444
-0.13083
-0.08722
-0.04361
0.00000
0.04361
0.08722
0.13083
0.17444
0.21806
0.26167
0.30528
0.34889
0.39250

SSRS sum based on not-null condition

I have a report I am building that I am summing a column with the total minutes listed in it then dividing it by 60 to get number of hours like so.
=Sum(Fields!designtimeValue.Value) / 60
But I have a condition where I want to weed out rows that contain other data in another column
Its laid out like so
Submittal_date Submittal_returned Design_Hours
12/01/2014 180
12/01/2014 12/02/2014 240
12/01/2014 60
So I want to do something like =Sum(IIF(Fields!sumbittal_returned.Value="NULL",Fields!design_hours.Value)) / 60
But it is throwing an error the sum iff does not allow that number of exceptions
I then need to take it a step further And be able to take the sum of design total if submittal_returned = NULL total then for any instance submittal_returned = Not-NULL add 120 minutes
Thanks
Edit : format code
IIF takes 3 arguments. A condition, a true result, and a false result. You have to supply all three.
This would be the correct syntax:
=Sum(IIF(IsNothing(Fields!submittal_returned.Value),Fields!design_hours.Value,0)) / 60
Although that condition will only be true if submittal_returned actually contained the string "NULL". If it's actually NULL (not a string), you would need test with the IsNothing() function.
Not sure I understand your last sentence, maybe you mean this?:
=Sum(IIF(IsNothing(Fields!submittal_returned.Value),Fields!design_hours.Value,Fields!design_hours.Value + 120)) / 60

Resources