User (Legacy) Posted June 9, 2005 Report Share Posted June 9, 2005 If I have a line graph, with the any values for the following dates: 4/1 5/1 6/1 7/1 7/2 7/3 7/4 7/5 It treats them all as equal values. Rather than the graph putting larger interval spaces between 4/1-5/1-6/1 (because each are a month), it treats them as regular labels, and all as days... doesn't scale right. It should know that it's 30 days between 4/1 and 5/1 and 6/1, but only one day between 7/1-7/5. How do I fix this? Link to comment Share on other sites More sharing options...
Software FX Posted June 12, 2005 Report Share Posted June 12, 2005 1) What type of Chart are you creating (Bar, Lines. etc.) ? 2) How are you passing the data to this chart ? -- Francisco Padron www.chartfx.com Link to comment Share on other sites More sharing options...
User (Legacy) Posted June 13, 2005 Author Report Share Posted June 13, 2005 Lines. Passing data manually. "SoftwareFX Support" <noreply@softwarefx.com> wrote in message news:fQDHFq2bFHA.200@webserver3.softwarefx.com... > 1) What type of Chart are you creating (Bar, Lines. etc.) ? > > 2) How are you passing the data to this chart ? > > -- > Francisco Padron > www.chartfx.com > Link to comment Share on other sites More sharing options...
Software FX Posted June 14, 2005 Report Share Posted June 14, 2005 Well, its very hard to help when you provide so little information. Posting the critical section of code usually speaks tons, in this case that would be the code that passes the data to the chart. Make sure you are passing those Dates as X-Values not as mere labels, by doing so you will allow Chart FX to get the actual value not just a string. Once the X-Values are set, they will be used to position each point in the X-Axis. -- Francisco Padron www.chartfx.com Link to comment Share on other sites More sharing options...
User (Legacy) Posted June 14, 2005 Author Report Share Posted June 14, 2005 It seems that the XValue is the key I was missing, however, when I use XValue, my labels disappear? See the following code function, and image. private void renderChart() { SoftwareFX.ChartFX.Internet.Server.Chart Chart1; Chart1 = new SoftwareFX.ChartFX.Internet.Server.Chart(this); Chart1.GalleryObj = SoftwareFX.ChartFX.Gallery.Lines; Chart1.Border = true; Chart1.OpenData(SoftwareFX.ChartFX.COD.Values, 1, 10); Chart1.OpenData(SoftwareFX.ChartFX.COD.XValues, 1, 10); string [] dates = new string[10]; dates[0] = "1/1/2005"; dates[1] = "2/1/2005"; dates[2] = "3/1/2005"; dates[3] = "4/1/2005"; dates[4] = "5/1/2005"; dates[5] = "5/2/2005"; dates[6] = "5/3/2005"; dates[7] = "5/4/2005"; dates[8] = "5/5/2005"; dates[9] = "5/6/2005"; Random rnd = new Random(DateTime.Now.Millisecond); for(int i=0;i<10;i++) { Chart1.Value[0, i] = Convert.ToDouble(rnd.NextDouble()*100); Chart1.XValue[0, i] = Convert.ToDateTime(dates[i]).ToOADate(); Chart1.AxisX.Label[i] = Convert.ToDateTime(dates[i]).ToShortDateString(); } Chart1.AxisX.LabelsFormat.Format = SoftwareFX.ChartFX.AxisFormat.Date; Chart1.AxisX.AutoScale = false; Chart1.AxisY.AutoScale = true; Chart1.CloseData(SoftwareFX.ChartFX.COD.Values); Chart1.CloseData(SoftwareFX.ChartFX.COD.XValues); try { Chart.InnerHtml = Chart1.GetHtmlTag(600, 300); } catch(System.Exception ex) { Chart.InnerHtml = "Could not render Chart chart due to: " + ex.Message; } } Link to comment Share on other sites More sharing options...
Software FX Posted June 14, 2005 Report Share Posted June 14, 2005 You don't want to assign labels at all, just X-Values, the labels Chart FX will display will be based on the data passes through X-Values. Delete the line: Chart1.AxisX.Label[i] = Convert.ToDateTime(dates[i]).ToShortDateString(); Performance/Style Suggestion: Use DateTime instead of strings to represent your date values. -- Francisco Padron www.chartfx.com Link to comment Share on other sites More sharing options...
User (Legacy) Posted June 15, 2005 Author Report Share Posted June 15, 2005 Thanks. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.