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.
Related
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?
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.
Using google sheets, I am trying to plot times between 9pm and 3am (sleeping time every night), with the x axis being each calendar date/day.
But the scale puts items just after midnight at the bottom of the y-axis (y is the time axis, x axis is the day), because of the timing (0:10) is 10 minutes later than midnight and I want it to reflect that on the graph.
The two graphs are waking and sleeping times.
Waking makes sense, sleeping does not:
The only way seems to be put an if else and change format completely converting time format to integer and then multiplying to get a number close to 24 hrs (and then 1am is 25, 2 am is 26, etc).
Is there not a simpler was to change the axis for time? Does no one else log times either side of midnight?
The two images below show the formula, and the chart data:
I am trying to make a basic line & point plot in Bokeh (0.12.3) using the following code. I have set the x_axis_type as 'datetime' and I am plotting a (random) variable vs. a pandas (0.19.0) datetime64 dtype that is the index of the dataframe (i.e. a timeseries).
The problem I see with the plot is that the dates are not properly aligned. In the time series, the max date is 2016-11-06, however, the last scale tick is for Nov 16, and there is a point aligned to what appears to be several days after that.
Curiously, when zooming in the plot, the alignment looks correct!
Is this a bug, or am I doing something wrong for this plot? Do I need to be more specific in how the x-axis should be rendered?
Also, I really think the scale increments should be in equal number of days. However in this case, Bokeh plots the scale increments to be on the same day of esch month (which is a varying number of days increments). I have seen this before in other plots, and that default can hamper interpretation.
Appreciate any help on this. Here is the code and the screen shots that demonstrate the issue:
# imports & config
import pandas as pd
import numpy as np
from bokeh.plotting import figure, show, output_notebook
output_notebook()
# create a times series dataframe
rng = pd.date_range('2016-07-24', periods=16, freq='W')
df = pd.DataFrame(np.random.randn(len(rng)), index = rng, columns=['Y'])
# view the tail of the data to compare to plot
df.tail()
# make and render the plot
p1 = figure(x_axis_type='datetime',
title='Y vs Week Ending',
plot_width=700, plot_height=400)
p1.xaxis.axis_label = 'Week Ending'
p1.yaxis.axis_label = 'Y'
p1.line(df.index, df['Y'])
p1.circle(df.index, df['Y'])
p1.yaxis.minor_tick_line_alpha=0
show(p1)
the last scale tick is for Nov 16, and there is a point aligned to what appears to be several days after that.
That tick is for Nov 2016.. it's not very intuitive, but the year is contracted into the label.
Knowing this may change your perspective w.r.t. this comment:
...I really think the scale increments should be in equal number of days. However in this case, Bokeh plots the scale increments to be on the same day of [each] month...
What it's done is change the base unit from day to month, which is probably the more correct approach.
I am new to SSRS world. I want to show the Horizontal axis label field as per below:
In my report I will pass a parameter called Year. In the repot it will show a line in Y-axis (it is limit field) and Date field is in the X-axis. I want to show total (12 + 1)=13 label like 1st date of every month (e.g. 1-jan-, 1-Feb) and last date of the selected year (31 -Dec).
Can anyone please help me regarding that?
Try to change the axis type to scalar, then set the following fields:
Minimum - 1
Maximum - 13
Interval - 1
Interval Type - Numbers