highcharts x axis date variable range - date

I have difficulty to make date range in x-axis for highcharts.
It based on user input that can have various date range, can be a month, 14 days, 2 months, etc.
Is it possible to give minimum and maximum date, and let the highcharts arrange the scaling between min and max date?
And how will be the correct syntax?
appreciate for the help.

You can set min/max values for xAxis, but dynamic version can be achived by using variables defiend by user.
http://api.highcharts.com/highcharts#xAxis.min
http://api.highcharts.com/highcharts#xAxis.max

Related

Get Dynamic Date Difference in Power BI

I am trying to get the difference between dates based on selected date values from a slicer.
From my image, the minimum date selected on the slicer is 5/10/2022 and the period to is all within 2022 therefore I was expecting a difference of less than 365. But it's subtracting 1/1/2008 which is the minimum date for my dates table.
I created the DateX_col to see the minimum value being used; my intention is to have that column show the minimum value selected on the slicer. How can I achieve this?
I'm using MIN(CALENDAR[DATES]) to get the minimum value dynamically, and I'd also like the same for MAX values.
Also, DATEDIFF(MIN(CALENDAR[DATES]), PERIOD_TO,DAYS) is not picking from the slicer, rather it's picking from the minimum value of the table. So my column: DateX_col = MIN(CALENDAR[DATES]) is showing 1/1/2008 and my measure: date x = MIN(CALENDAR[DATES]) is showing 5/10/2022.
It is not possible to get a dynamic MIN column in Power BI.
We can get dynamic data differences by creating a measure([Periodto - Datex]) using the measure ([date x).
Periodto - Datex = DATEDIFF([date x], MIN(Table1[PERIOD_TO]), DAY)

How to calculate average for the calendar year

My input file consists of column Actual Exp and Actual Min.
Now I want to create a measure for calculating the average for the current calendar year having the latest month of data for Actual Exp and Actual Min.
I want to calculate the average from Jan'21 to Mar'21, and later if data gets added for Apr or May I would like to calculate the average from Jan'21 to May'21 or Apr'21.
Similarly, I want to have from Jan '21 to Dec'21 in Dec'21 and an average from Jan'22 to Feb'22 in Feb'22. I also have a date filter I don't want my date filter to affect the average.
I tried using TOTALYTD and MAX(Date), but it's not working.
Thanks.
I've not fully understood your question, but hopefully this helps:
AVERAGEX ( ALL(TABLENAME), TABLENAME[COLUMNNAME])
This should give you an average of COLUMNNAME no matter what filters/slicing you have in place.
If you wanted to futher restrict this, you can try creating a 2nd measure such as
CALCULATE(AVERAGEX ( ALL(TABLENAME), TABLENAME[COLUMNNAME]), datetable[monthcolumn] IN {"Jan", "Feb", "Mar"})

SSRS 2008 Calculated Chart X-Axis Interval

I am trying to create a chart where the interval on the X-axis will redefine itself depending on the 2 time parameters I have set up for the report; I have a #StartTime and a #StopTime. If the difference between the dates is one day, I want the graph axis to show a mark at each whole hour during that day. But any more than a day then the interval can be automatically determined by the program.
I have manually set the difference between the 2 parameters to be 1 day and set the interval and interval type to "24" and "hours", respectively, which gives me the desired results.
I have tried the following function for the interval:
=IIf(DateDiff("d",Parameters!StartTime.Value,Parameters!StopTime.Value)=1, "24", "Auto")
And I have tried the following function for the interval type:
=IIf(DateDiff("d",Parameters!StartTime.Value,Parameters!StopTime.Value)=1, "Hours", "Auto")
I created 2 random textboxes into which I inserted these functions to test if the functions are actually working, and they are. So I can't figure out why the functions won't execute properly when inserted into the interval properties fields.
Why is this not displaying the desired outcome?
Instead of using the text "Auto", use a Nothing to represent Auto.
eg:
=IIf(DateDiff("d",Parameters!StartTime.Value,Parameters!StopTime.Value)=1, 24, Nothing)
If I recall correctly, you can't change the the axis type at render, which seems like what your trying to do. Honestly I think this might be a case for cheating, make the chart twice, one for each axis type you want, and then conditionally hide them based on a similar Iif statement to the ones you have above.
Other thoughts, 24 is not the interval you want, interval is how much of the x-axis is displayed as tic marks. 1 means 1 tic for every 1 value, 2 means every other one, and 24 if it works would be showing every 24th value (haven't tried it). You want a number interval with a type of hour and an interval of 1 because you want to show every hour. You'll also have to change your x axis to:
=datepart(hour, Fields!YourDateTime.Value)
Otherwise the numbers axis type won't work. You can use similar expressions to create day over day time comparisons. Anyway, good luck!

How do you use time as an axis in a Core Plot graph?

I have two arrays arr1 and arr2 containing datetime in dd/MM/yyyy HH:mm:ss and HH:mm:ss respectively.
For eg. arr1[0] contains 23/12/2011 09:15:30 while arr2[0] contains 09:15:30.
Note that arr1 will always contain today's date, which is exactly what I want for my iPad app which I'm preparing using Xcode 4.2.
I want to plot specific time (either from arr1 or from arr2 whichever is best suitable) on the X axis and corresponding float value contained in an array arr3 on Y-axis.
Now I'm stuck at plotting time on X axis as I can't pass time in dd/MM/yyyy HH:mm:ss or HH:mm:ss.
I googled about it and got the suggestion to use epoch but I'm unable to implement it for my app.
Other than using epoch, how can I pass a time value to Core Plot for the X axis?
Core Plot requires numeric plot data. You'll have to find a way to convert the dates to a number. One way is to convert each one to an epoch value as you mentioned. If the dates are not evenly spaced, that may be your only option.
If you know that the dates are spaced at regular intervals (e.g., hourly, daily, monthly, etc.) you could just figure an index that corresponds to each date. Make custom labels to display the dates and set the plot space range to cover the correct range of indices.

core-plot and NSDate (iPhone)

I wish to plot a line graph where the x-axis is defined as a number of days between two dates and the y-axis is a value that varies on each of the days.
I can plot the y values as an NSNumber but I have no idea how to set the ranges and the markup on the x-axis. I have looked at the date example in the "examples" directory of the core-plot distribution but have found it a little confusing.
Does anyone know of a tutorial, or code sample, which might asist me in this regard?
Thank you in advance.
There are two main concepts you need to be aware of: how to format the dates and how to convert the dates into numbers for the axis ranges and data values.
Core Plot provides a CPTimeFormatter class that takes care of the formatting. You provide an NSDateFormatter set to whatever format you want to use and a reference date to define the origin of the numeric scale. Set the labelFormatter property on the axis to your initialized CPTimeFormatter and it will take care of converting the numeric data to dates and applying the desired format.
The key to calculating the numeric values is that you need to find the difference between your reference date and the date value of interest in seconds. That's why the sample program defined oneDay = 24 * 60 * 60.
24 hrs/day * 60 min/hr * 60 sec/min = 86400 sec/day.