What is the significance of the emitted event.point.index from mousing over a chart? - anychart

I am trying to determine the nearest x value of the user's mouse position on a simple line chart. Is there any way to do this?
I have already tried adding a pointMouseOver and pointsHover listener to the chart instance, and, while they emit some kind of index, the number of indices far exceeds the number of x values in the chart (My chart had around 600 x values, the largest index emitted is around 1000).
this.chart.listen('pointMouseOver', function (event) {
console.log(event.iterator.getIndex())
console.log(event)
})
returns some arbitrary index instead of the nearest x value.

Managed to answer my question myself while looking through the charts API reference - to get the nearest x value on pointsHover, call event.point.get('x'). https://playground.anychart.com/api/_samples/anychart.enums.EventType.pointsHover

Related

How do you get "Box" values out of "Array" in Python for use with `click()`?

NOTE: Using PyAutoGui library
I am trying to make python click on each icon on screen in order, I have gotten it to successfully print each item on screen with it's box values of left and top in place of X and Y coordinates. But I can't figure out how to get left/top converted into X/Y values for use with the pyautogui.click()
Code:
import pyautogui
coordinates = pyautogui.locateAllOnScreen('eachIcon.png')
for element in coordinates:
print(element)
Prints:
Box(left=124, top=699, width=14, height=14)
What command would I use to extract Left and Top as X and Y number coordinates?
I am entirely new to python and practically new to coding (took a beginners class of C++ in college). I've spent a good hour googling and trying every term I can think of, I'm stumped: hence the post.
To do this you will need to unpack a tuple:
Box has 4 objects Box(left=124, top=699, width=14, height=14) to unpack Box we can just add 4 dummy variables (since we only need x,y) to your for code
for x, y, _, _ in coordinates: or for x, y, w, h in coordinates if you also want the weight and height
I inserted the dummy variables because otherwise we will get a ValueError.
The error occurs when the number of variables doesn't match the number of values so if we had for x, y in coordinates: we would get a ValueError.
You could also access a tuple by doing
x = [0]
y = [1]
But i suggest you to use the for code since you also want to click them in order
coordinates.left coordinates.right etc should do the trick

Excel - Find a Cell in an array and its location

Looking to figure out how to determine the address of a cell in an array based on a previously determined max value. See the attached picture:
What I'm looking for in this image is the cell directly above the minimum value of 192.02. Total minimum value is determined by finding the minimum across the row, then down in a column. I need to figure out how to bolt on a formula that will essentially find that location and move up one cell. Duplicates aren't an issue - the first match is sufficient.
Haaaaa... I found out a method using SUMPRODUCT, but it wasn't working out for me, reporting a circular reference. I couldn't figure out what the hell the issue was until I realized the "row check" formula extended infinitely to the right and I'd put the formula in a cell in that area - thereby making it an infinite loop. Embarassing.
The method I found was this, incidentally:
=SUMPRODUCT((K6:M20=H24)*(COLUMN(K6:M20)))
=SUMPRODUCT((K6:M20=H24)*(COLUMN(K6:M20)))
Where H24 is my minimum value and K6:M20 is the range. Then you can use INDIRECT with these values to get the value of that cell. In my case, I'd use
=INDIRECT(ADDRESS(ROW-1,COLUMN),TRUE)
To find the cell directly above that value. Sometimes just posting a question can solve it for you, haha.

Silverlight Visifire Chart Axis Minimum Interval

I have a stacked bar chart with Days values displayed on the X Axis that needs to dynamically change it's size.
When I have a small number of points, let's say 2, the Interval value has a small value and instead of seeing only 2 labels on the axis, there are a lot many.
The ideal value would be Interval = 1 (with IntervalType="Days"). But this causes another problem: when the Interval is set like this, in case there are a lot of points and the size of the chart is small, the labels are all displayed because the Interval does not change.
Here are a few screenshots to illustrate the problem:
http://imgur.com/LEFEZjq,seYdvMJ,eVydRNB,Jwvu5s7
Interval left default and enough points (5/31 - 6/10):
http://imgur.com/LEFEZjq,seYdvMJ,eVydRNB,Jwvu5s7#0
Interval left default and small number of points (5/31 - 6/1):
...#1
Interval = 1 and small number of points (5/31 - 6/1):
...#2
Interval = 1 and large number of points (5/31 - 7/29):
...#3
My question is: Is there a way to have both? To set the Interval to 1 but still get rid of excess labels when the don't fit?
My idea was to have Interval be a maximum of 1 and the default calculated value, and I tried to implement it by changing it at the Rendered event, but this doesn't seem to work.
Nevermind.. I just went with a Numeric DataMapping instead of the DateTime one and mapped the AxisXLabel and ToolTipText to the date.
With dates it seems a little buggy but this way it works fine.

SSRS line chart. How to stop numbers from repeating in vertical axis

I have a line chart in ssrs. Whenever the highest line values are 1 or 2 instead of getting a scale of 0,1,2 which is what I want, I get 0,1,1,2,2. This dosn't make sense especially because the number values are not decimals and are unformatted.
Please help.
The Expression for the vertical axis Interval should be below expressions.
If your value is sum
=IIF(Max(Sum(Fields!Item.Value))<20,1,"Auto")
If your value is count
=IIF(Max(Count(Fields!Item.Value))<20,1,"Auto")
Note: I used 20 as the above that the Auto will work good. Make according to your requirement.
Sounds like there is formatting on the vertical axis: That it's actually trying to show 0, .5, 1.0, 1.5, & 2 but after rounding that comes out as 0,1,1,2,2
You should change the vertical axis interval from "Auto" to 1:
I understand that this is quite old post. Still I wanted to reply..
I faced the same issue on column chart when the scale was of small range....
So I used the following expression in axis properties->interval
=IIF(Max(Fields!count_Items.Value)>=6,0,1) - [note: here 0 means - Auto interval]
Hope this answer helps someone. :)
The problem here is not only the interval but also the maximum value of the range that the axis uses. You can set the value for the Interval with this type of expression IIF(Max(Sum(Fields!Item.Value))<20,1,"Auto") but the axis can still make the scale too large. It then tends to fill in with decimals or if you suppress decimals you get repeating integers.
Use a custom code like this:
Public Shared Function AxisRange(ByVal Number As Double) As String
Dim RangeString as String
If Number <=5 Then
RangeString ="5"
Else If Number <=10 Then
RangeString = "10"
Else RangeString = "Auto"
End If
Return RangeString
End Function
In the Maximum value of the range use an expression like:
=code.AxisRange(Max(Fields!Field.Value))
By doing this you force the maximum value of the range to be a similar size to the maximum value in your chart. This solves the problem.

JFreeChart selectively render lines

Please see the the xy/timeseries chart I have posted here: http://imagebin.org/151195
How do I selectively render only the horizontal lines, and leave out the lines between the neighboring data points that don't have the same y value? Basically the result would be a series of horizontal lines?
You'll have to scan your data model to find the ordinate where dy/dx < ɛ, for some value of ɛ near zero. Of course, you'll have to scan past the initial flat part, and decide how to deal with a series that never rises above ɛ.
Once you know the desired ordinate, use setLowerBound() on your domain axis.

Resources