.NET Framework Developer Center > .NET Development Forums > Chart Controls for .NET Framework > Multiple Days of DateTime Plotted on the X-Axis
Ask a questionAsk a question
 

AnswerMultiple Days of DateTime Plotted on the X-Axis

  • Thursday, November 05, 2009 7:59 PMKyle C. Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hi,

    I am currently trying to plot multiple days worth of state changes. The X-Axis is the time the change occurred, and the y-axis is the sum of elements in a certain state. These State Changes will only occur between the hours of 9:00am and 4:00pm.

    The problem is that I am getting a lot of "filler' data, just noise between those hours when specifying multiple days. I filtered out anything between those hours and it came up white space. To remove the white space, I tried setting IsXValueIndexed=true. That SEEMED like it fixed it, however I realized that because state changes are only entered when they occur, that the number of points is not equal day to day. Thus, if Monday an anomaly occurred and elements states are constantly fluctuating, it could take up half the graph, while Tues-Friday take up the other half.

    What I would like to do is have the graph represent each day equally, no matter how many actual data points are listed. If Monday has 1000, and Tuesday only 10, they need to be the same width so it is obvious that Monday fluctuated heavily and that Tuesday was a relatively stable day.

    Does anyone know anyway to do this? The only thing I can think of is to plot the state every second so there is an even amount of points. That would give me excess points being added and would be difficult to do. If I have to do it, I guess I have to, but I was wondering if there was any other more elegant way.

    Let me know if you need any additional details.

    Thanks,
    Kyle

Answers

  • Tuesday, November 10, 2009 12:46 PMKyle C. Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    Sipla - I tried your method Sipla and didn't end up getting the results I was looking for either.
    Cole - Yeah nothing came to mind for me either. I thought it about it, and I tried creating it so it checked every second what the data was and then plotted it. I ended up with the same graph though, so my code to do that was wrong or the chart will graph it that way either way.

    The only other solution I could come up with that would be feasible would be to create 5 chart areas, each 1/5 the total width I want, and then graph a single day into each and stack them horizontally to get what I wanted.

    I ended up leaving it as is for now, because it isn't a 100% necessary feature, but if I end up implementing something that works I'll update this thread to let you know how I did it.

    Thanks for the suggestions Cole and Sipla.
    • Marked As Answer byKyle C. Tuesday, November 10, 2009 12:46 PM
    •  

All Replies

  • Friday, November 06, 2009 12:42 AMCole Brand Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Have you considered a rangebar type of graph (or range column)? The visual detail would be different, but it would perhaps be easier to both visually grasp and to code.

    If this is for a dashboard style arrangement, consider doing five pie charts in a row... that would be unique.
    Please don't forget (and feel free to remind me) to post if you got the answer you wanted, and select who really answered your post when you do so future visitors will know too! Remember, this is .NET 4.0 in a .NET 3.5 world, you're a pioneer right now.
  • Friday, November 06, 2009 12:59 PMKyle C. Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hmm, I don't feel that it is right for the situation. I have it is a stacked area 100 graph as something everything is in a state at all times. I basically get updates on my 9000 objects every few seconds, and if they have changed from the last update, I record the state change.

    The problem with the graph isn't the data it has, it using time as the x-axis. The range graph would still fall into the same problem with it either showing certain days too large (because they had more state changes) or I'd be left with some white space when I take anything before 9 and after 4 out of the range (not that I have any datapoints during that time. It just links the 4:00pm of one day to the 9:00am of the next using a linear line).

    Here are two links to examples that I show the problem somewhat well. I say somewhat because it isn't as pronounced in this week as others.

    Here is the original over time: http://i36.tinypic.com/2csjvbt.png . As you can see it has tons of filler data just because it shows all of time instead of the subset 9-4.

    Here is the one with XIndexed: http://i36.tinypic.com/2i6jdeb.png . As you can kind of see, Oct 30th has more changes than the 29th and as such is longer. I would just like each day to be the same width as they each contain the same amount of time's worth of data.

    If the only way to really do that is through the data points by equalizing the number between them, I could program it to fix that, I just wasn't sure if there was an easy date range chooser considering some of the charts I saw were for financial markets which typically aren't open 24/7.

    Sorry for the longwindedness and thanks for helping. The five pie charts would be unique, (and kind of neat) but I was asked to format it like this as they want it all on one chart.

    Let me know whether you have any ideas or not. If not, please just let me know, so I can conclusively say one way or the other that it doesn't seem feasible using just the graphing tool.

    Thanks so much!

  • Friday, November 06, 2009 3:33 PMsipla Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Has Code

    I tried this on a simple one series line-chart and I think it worked the way you wanted.. Not sure if it's what you need though.

    	Chart.Series("SERIES").IsXValueIndexed = True
    	Chart1.Series("SERIES")("EmptyPointValue") = "Zero"
    	Chart.DataManipulator.InsertEmptyPoints(1, IntervalType.Hours, "SERIES")
    	Chart.DataManipulator.Filter(DateRangeType.Hour, "9-16", "SERIES")
    

    The data should end up having the same number of datapoints for each day (except maybe the first and last, depending on the data), and no datapoints between 9am and 4pm. You'll have to change the intervals to something suitable for you ofcourse.

  • Friday, November 06, 2009 8:37 PMCole Brand Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Sorry, nothing comes to mind as a solution. Been a bit of a day here on this end too. Perhaps on Monday I'll get a fresh take? I'm curious if there's anyway to break the data down into smaller chunks...
    Please don't forget (and feel free to remind me) to post if you got the answer you wanted, and select who really answered your post when you do so future visitors will know too! Remember, this is .NET 4.0 in a .NET 3.5 world, you're a pioneer right now.
  • Tuesday, November 10, 2009 12:46 PMKyle C. Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    Sipla - I tried your method Sipla and didn't end up getting the results I was looking for either.
    Cole - Yeah nothing came to mind for me either. I thought it about it, and I tried creating it so it checked every second what the data was and then plotted it. I ended up with the same graph though, so my code to do that was wrong or the chart will graph it that way either way.

    The only other solution I could come up with that would be feasible would be to create 5 chart areas, each 1/5 the total width I want, and then graph a single day into each and stack them horizontally to get what I wanted.

    I ended up leaving it as is for now, because it isn't a 100% necessary feature, but if I end up implementing something that works I'll update this thread to let you know how I did it.

    Thanks for the suggestions Cole and Sipla.
    • Marked As Answer byKyle C. Tuesday, November 10, 2009 12:46 PM
    •  
  • Tuesday, November 10, 2009 3:57 PMCole Brand Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    That seems best. Wish I could offer more, but without being in the problem domain... ah well.
    Please don't forget (and feel free to remind me) to post if you got the answer you wanted, and select who really answered your post when you do so future visitors will know too! Remember, this is .NET 4.0 in a .NET 3.5 world, you're a pioneer right now.