iOS Charts Line Chart X Axis values repeated - swift

I have multiple data points for each month:
And I get the x-axis of my graph repeated like Feb Feb Feb Mar Mar Mar Mar
Each data point is important because it reflects how long something took them on that day. So I cannot just sum all the values for a month or something like that.
How do I fix this?
I currently have the granularity set to 1 for the xAxis but I don't quite understand how granularity works.

Can you group your data, so that it is sum'd (or some other aggregate function) by month?
This would get your data to have one value per month, and therefore should solve the issue.

add this:
xAxis.granularityEnabled = true
as per document it says:
/// When true, axis labels are controlled by the granularity property.
/// When false, axis values could possibly be repeated.
/// This could happen if two adjacent axis values are rounded to same value.
/// If using granularity this could be avoided by having fewer axis values visible.

Related

Chart.js Align two time scale axis

We are using chart.js lib Version 3.7.1.We have multichart graph with line and bars. Both using time scale on x axis, but one has one month value, while second has one day value.
example:
const dailyAxis = [27-05-2022, 30-05-2022, 31-05-2022, 01-06-2022, ... 07-06-2022];
const monthlyAxis = [31-03-2022, 30-04-2022, 31-05-2022, 30-06-2022];
The problem is, that daily values could start from the middle of the month or one month could have 20 daily values, other could have 30. Is it possible to align two charts, to have first daily point at start of monthly bar and last point at the end of monthly bar, no matter how many daily values we have?

Tableau - creating vertical lines on specific dates when the date axis (x-axis) is set to "week"

I'm graphing weekly total page loads per 1000 students, which is easy enough when the pill for the page load variable is set to 'sum', and the date pill is set to 'week number.'
BUT, I also have a table that lists individual dates on which important policy changes occurred, and I want to draw those as vertical lines.
Using a dual axis, I have been able to plot the specific dates as lines, but because the resolution of the date axis is set to "week", it lumps all dates in the policy change table that occur within a single week into one, or possibly omits dates that don't land on the right date for that week, and therefore I don't get individual lines for every policy change.
weekly resolution, dates omitted
I have been able to approximate what I'm looking for by setting the date pill to 'day,' and then doing a rolling average of the page load values--but this doesn't represent the page loads in the way I need it to.
rolling sum, not the same calculation, but includes dates
I need either a way to layer two charts on top of each other, with different x-axis resolutions, or possibly the correct calculated field that gives me the straight up weekly sum of the daily total page loads for successive weeks, so I can use the 'day' setting on the date-time access but still get the weekly values I want, and then plot all dates in the policy change table.

Tableau constant reference line issue when changing date range

I have a few reference lines showing the previous year's averages. The problem I'm running into is when I select a smaller date range (like 10 days vs 90 days) the chart just cuts to that date range instead of resizing the entire chart so that you can look closer at the selected days. Is there a way around this?
This is not how I'd like it to look when I isolate down to a smaller timeframe:
Resolved...changed the date to discrete that fixed the issue.

Highstock charts - Show the blank space up to the current date

Currently, I'm having trouble to force the highstock chart to display a blank space up to the current date. It focuses the data I give it.
What I have is:
What I want is something like this
As you can see I want the data to stop at the date of the latest data point and then the graph should show a blank space and stop at the current date. Obv there is not data points for those times
You can control how empty points, and missing points are shown by looking at:
xAxis.ordinal
In an ordinal axis, the points are equally spaced in the chart regardless of the actual time or x distance between them. This means that missing data periods (e.g. nights or weekends for a stock chart) will not take up space in the chart. Having ordinal: false will show any gaps created by the gapSize setting proportionate to their duration.
xAxis.max
The maximum value of the axis. If null, the max value is automatically calculated.
plotOptions.series.connectNulls
Whether to connect a graph line across null points, or render a gap between the two points on either side of the null.
Which means that for your graph, you will want to set:
xAxis: {
ordinal: false,
max: (new Date()).getTime() //to set the current date and time as a maximum
}

SSRS Chart with Date Axis

I want to create a chart in SSRS. My data contains timestamps when a state changes from 1 to 0, or vice versa:
Date Value
3/31/2011 4:44:38 PM 1
4/4/2011 2:35:43 PM 0
4/4/2011 3:05:09 PM 1
4/4/2011 5:57:10 PM 0
4/4/2011 7:08:29 PM 1
4/4/2011 7:22:03 PM 0
4/4/2011 9:00:32 PM 1
...
I'd like the X Axis for the chart to show the full date range (which it does) and then show the data as a stepped line showing when the state changes from one to another. The problem is, SSRS doesn't treat the x axis as a date range and plot the values relatively- it seems to just treat each data point as a simple date-unaware plot for the chart. At the moment I get this:
But what I want is something where the data points are plotted relative to their datestamp - this would give you an indication of how long the state was either 1 or 0 - kind of like this poor mockup (the black line is what I want instead of the blue line):
Is this possible?
Damn. In the end it was just a checkbox! I needed to go to the properties of the X Axis (the date range) and check "Scalar Axis". Done.