If I set the "HH:mm" format for axis, time displayed on the axis is rounded to every 30 minutes and intermediate times are added as well, which are not present in data. How to display only actual times and without rounding?
For example this is the data and this should be displayed on the axis:
18:02 18:58
But instead this is displayed on the axis which is not what I want:
18:00 18:30 19:00
It can be done by subclassing DateTimeAxis and overriding GetTickValues.
DateTimeAxis.ToDouble is handy there to convert from DateTime to double.
Related
This is a bit of a long-shot. I really don't know where to ask this question.
I've been trying out CodeConnection + MakeCode with Minecraft and I haven't been able to figure out if there is correct way to place half-slabs at 0.5 step y axes increments.
I tried using a line between 2 points, but it left gaps between each slab.
If I try moving up 0.5, then it rounds it up to 1, and again leaves gaps.
It appears that all of the builder functions seem operate at a resolution of 1 block. However in-game I can obviously place slabs in 0.5 block increments to make stairs etc.
Blocks only exist at integer coordinates. Half slabs that exist in the top half of their space are still at a full integer coordinate. They just have a BlockState value of bottom=top (or top_slot_bit=true on Bedrock, represented by the integer value 8 as a bitflag, eg: 0b1... where the . bits are the integer representation of what type of slab (wood, stone, quartz...)).
What you're looking for is this widget, under Blocks:
You can set the block and then an integer representation of the desired data value (see the wiki on data values) in the numerical slot. This widget can then be dragged into the (block) portion of any block widget:
You'll probably have to some variable fiddling to get the data value to swap back and forth as you need it to, but that should solve the hurdle you've been facing.
Pandas documentation lists a bunch of "expanding window functions" :
http://pandas.pydata.org/pandas-docs/version/0.17.0/api.html#standard-expanding-window-functions
But I couldn't figure out what they do from the documentation.
You may want to read this Pandas docs:
A common alternative to rolling statistics is to use an expanding
window, which yields the value of the statistic with all the data
available up to that point in time.
These follow a similar interface to .rolling, with the .expanding
method returning an Expanding object.
As these calculations are a special case of rolling statistics, they
are implemented in pandas such that the following two calls are
equivalent:
In [96]: df.rolling(window=len(df), min_periods=1).mean()[:5]
Out[96]:
A B C D
2000-01-01 0.314226 -0.001675 0.071823 0.892566
2000-01-02 0.654522 -0.171495 0.179278 0.853361
2000-01-03 0.708733 -0.064489 -0.238271 1.371111
2000-01-04 0.987613 0.163472 -0.919693 1.566485
2000-01-05 1.426971 0.288267 -1.358877 1.808650
In [97]: df.expanding(min_periods=1).mean()[:5]
Out[97]:
A B C D
2000-01-01 0.314226 -0.001675 0.071823 0.892566
2000-01-02 0.654522 -0.171495 0.179278 0.853361
2000-01-03 0.708733 -0.064489 -0.238271 1.371111
2000-01-04 0.987613 0.163472 -0.919693 1.566485
2000-01-05 1.426971 0.288267 -1.358877 1.808650
To sum up the difference between rolling and expanding function in one line:
In rolling function the window size remain constant whereas in the expanding function it changes.
Example:
Suppose you want to predict the weather, you have 100 days of data:
Rolling: let's say window size is 10. For first prediction, it will use (the previous) 10 days of data and predict day 11. For next prediction, it will use the 2nd day (data point) to 11th day of data.
Expanding: For first prediction it will use 10 days of data. However, for second prediction it will use 10 + 1 days of data. The window has therefore "expanded."
Window size expands continuously in later method.
Code example:
sums = series.expanding(min_periods=2).sum()
series contains data of number of previously downloaded apps over time series.
Above written code line sum all the number of downloaded apps till that time.
Note: min_periods=2 means that we need at least 2 previous data points to aggregate over. Our aggregate here is the sum.
Those illustrations from Uber explain the concepts very well:
Expanding window
Sliding window
Original article: https://eng.uber.com/omphalos/
I have a value range, say the iPhone screen size 480x320. I have a position that may be outside the range, let's say the position's x coordinate is 600 for example.
In order to adjust the x coordinate to its on-screen position I can do: 600 - 480 = 120
But when the value is greater than two times 480 I'd have to run a loop, subtract 480 until the resulting number is below 480.
I know there's an optimization to this problem revolving around division/modulo but I just can't find a good answer (or question) related to this. Mainly because I can only guess possibly helpful search phrases.
I'm feeling sick today and for the live of me I can't wrap my head around it. I'd welcome any pointers, even a "close as duplicate".
PS: this is for Objective-C but any language will do.
You are looking for the modulo operator. The solution for the case of a width of 480 is:
x % 480
Modulo will guarantee that the resulting value is between 0 and 479.
I have NSSlider, and I rect to it's changes. But I want my action to work only if slider's float value is for example 2.230000 or 3.410000.
if (floatValue is y.xx0000) {
doSomething;
}
I mean I want to do some action only if my float has only 2 decimal places not equal to 0. How could I do it?
The only float values that have only two non-zero fractional digits are numbers of the form n.00, n.25, n.50, or n.75. All other values have more than two non-zero fractional digits. Your example, 3.41, for example, isn't really "3.41". Instead it's:
3.410000000000000142108547152020037174224853515625
and "2.23" is actually:
2.229999999999999982236431605997495353221893310546875
So what are you really trying to do?
I'm a bit late to this game, but I found this question while searching for something similar.
It sounds to me like what you're trying to do is to round the value that the slider is set to to 2 decimal places. That way the thing and/or calculation you're trying to configure with the slider, will always work as though it only works for exact 2 decimal values.
Alternatively, you could check how large the distance is between your float value, and the value rounded to 2 decimal places. And then put a threshold of for example 0.005 for when it's to far away.
I have a problem with a report that is build using report builder 2.0, on a sql2008 database (latest service pack installed), reporting services Version 10.0.5500.0.
The problem is that the bars are wider then they should be. Each bar should be as width as 1 hour.
The x-axis is configured with the interval set to hour and an interval value of 1 the min-value of =TimeSerial(0,0,0) and max-value of =TimeSerial(23,59,0). The series has a CategoryField set to the [hour], a column of type time with the time of an hour (Example 08:00:00.0000000).
What you are looking for is in the properties grid under General--> Custom Attributes --> PointWidth
You have to select the series first.
If you can't see the properties grid you need to enable it from the ribbon. View, check the box next to properties.
Numbers less than 1 will give gaps between the bars, number greater than 1 will cause the bars to overlap.
It's more of a relative width setting than abosolutely related to your Hour interval, but you can tweak it so its right.
Personally I would suggest you have it slightly less than an hour because they look better with gaps.
barchart1.png
You should also set the labels on the horizontal axis to be vertical and then rotate them so it looks a bit better.