Graphing Current State in Stepchart - asp.net

I've been stuck on this for a few days. I have an object that contains:
DateTime Start;
string State; //current state of Item "ON", "D", "SB", "OFF".
int Duration; // in seconds
I need a step chart that charts the current state of the item by time of day. The chart has time of day along the bottom. States on Y axis 1 and duration on y axis 2. I know the data is getting through, because I have a table below the chart that displays the same data.
I currently have start on Category fields and Duration on secondary axis and Status on regular axis. The main problem is it's not graphing at all.

Figured it out I had to set a switch to get the state to graph correctly on the positions. I then hid the labels and put the correct tags in place. Also when I set the date time for the x axis and set it to increment by hours it set the current day I made that change so when I handed it a day in the past it threw the whole set out as not meeting the criteria.

Related

Date Axis in a Telerik Reports Line Graph

Does anyone know how to set up a date time axis to use DateTime Scale in a line graph in Telerik Reports? I have been trying to figure it out for over a week now. I don't understand why this thing has to be so difficult to use. I started by setting up a line graph.
I have three columns DATE, SALES_COUNT, and SALES_TYPE. I want there to be three lines on the graph. One for each value of SALES_TYPE. I used SALES_TYPE for the series, SALES_COUNT for the value, and since I didn't have any other options left, I used DATE for Categories. I clicked finish and previewed my graph. The graph looked right except I wanted to make a few customization to the DATE axis. Specifically I only wanted it to write out a date label for every 5 ticks or so. There was no way to do this.
Eventually I figured out that I have to set the axis to use DateTime Scale since it defaults to Category Scale. I set it to date time scale and previewed the graph again. I got the error: "X value cannot be null or empty when using DateTimeScale, lineSeries1", so I went to lineSeries1 and set the X value to "= Fields.DATE", and clicked preview. Now the graph nolonger displays any of my data points, and there is only one tick on the DateTime axis and its labeled as 1/1/2015 12:00:00 AM, a DateTime that is not even in my dataset. I have been struggling for over a week now to figure out how to do this simple task. Please help me.
The SQL query I was using was handed to me by the DBA. I never really looked at it, I just stuffed it into the report. It turns out the query was returning the DATE column as a varchar. Once I cast the DATE column as a date in the select column list of the query, Setting the axis to use DateTime Scale worked fine. If anyone else runs into a similar problem, check the return types of your columns.

changing the displayed labels on a tableau liner graph

In my tableau visualization I need to show the change in a metric over every minute for a day.
I have a "minutes" table in my db. Each row has columns: "minute_id", type int
"minute", type string: carries the value of the time eg: "05:33, 12.30, etc"
"min_date_time", type datetime: carries the value of the time datetime equivalent of the above string value eg: "2013-11-01 2:30:00 AM, 2013-11-01 2:31:00 AM, etc"
A second table called "demos" has all the metrics that are shown for that specific minute.It has relevant columns as follows:
"minute_id", type int: foreign key for the minutes table
"ind2plus", type float: value to be displayed on the y axis for each "minute_id"
This is what I have so far:
The problem Im trying to solve is:
On the X axis currently the displayed unit is "minute_id".
I would like to keep minute_id as the values on the X axis,
but I would like to change the values "displayed" as labels on the X axis from
the int value in the "minute_id" column to the string value in the "minute" for every "minute_id".
How do I do that? Please advise.
UPDATED GRAPH:
If you have a true datetime field in your data, you get more flexibility by using that field for most situations.
So I suggest putting your min_date_time field on the columns shelf to replace minute_id.
Tableau allows you to use dates and time fields in many different ways for different effects -- so many options that it can be confusing. You have to choose whether to treat the field as a dimension or measure, whether to treat it as discrete or continuous, and what level of granularity to use (hour, minute, month, exact date ...) It will take experimentation and experience to get comfortable with implications of the different choices.
For your graph, I would start by choosing a continuous dimension at the minute level. You can adjust the settings by clicking the little triangle on the right of the pill on the columns shelf. The truncated date settings are the second batch of date menu options and result in a green pill. Once set, you can drill up/down granularity with the + on the left of the pill.
Finally, once you are happy with your chart, you can change the formatting instructions to affect how dates are displayed on the axis. Right click on a number on the axis, choose format, and then in the format pane, under scale you should see a pull down labelled Dates. You can choose one of the existing date formats or enter a custom one. The format strings are pretty much what you expect.

How to change the X Axis labels programatically on ASP.Net chart control?

I have a line chart that I am building from a SQL Data Reader which is filled from stored procedure with begin and end date parameters.
When the chart is drawn the X axis lables are the day part of the date and time string that are returned. What I would like to do is change that to the hours portion when the range is less than 24 hours.
How do I go about changing the X Axis labels?
TIA
John
I don't have the code right in front of me but you should be able to do this via something like:
chart.ChartArea(0).AxisX.CustomLabels.Add

Zedgraph- Force curve graph to start from y-axis for datetime x points

In Zedgraph (asp.net) I have a datapoint list where the x values are of datetime. When the curve is drawn, the start of the graph does not begin from the y-axis. There's a gap between the y-axis and the first point. I am using XAxis.Scale.MajorUnit = DateUnit.Day.
I see a date tic label at the y-axis level which is a day before the day of the first point. Basically ZedGraph is inserting a new point, a day before, (no value for y) before the first point, creating the gap. Is there a Zedgraph setting to stop this?
When I use textlabels (XAxis.Type = AxisType.Text) instead of datetime labels (XAxis.Type = AxisType.Date), it works fine but I want to use the date type.
Any ideas?
Have a look at these properties:
XAxis.Scale.MinAuto = false;
XAxis.Scale.MinGrace = 0;
XAxis.Scale.Min = (whatever your minimum DateTime is);
Chances are, MinGrace is what you're looking for, and the associated property XAxis.Scale.MaxGrace should control any gap on the maximum side.

Flex LineChart advanced horiztonal axis?

I want to make a line chart that allows the user to select a date range for the data. For example if the date range span is more than 1 month, I want to to have a bar that shows the months, also if the date range is around 30 days or less I want it to show the dates for each day as well. Something like that.
Does anyone have any suggestions?
Thanks!
I would suggest using a DateTimeAxis, and setting the labelUnits property to "days" or "months" as appropriate. The axis will then do all the hard work of grouping your data accordingly.
In your particular case, when the user makes a choice from the combo box, you should have a handler that computes how granular to make the x-axis based on the user's date selections.

Resources