Nevron Forum
Back
Login
Register
Login
Register
Home
»
Nevron Vision for SSRS
»
Nevron Chart for Reporting Services
»
X-axis dates with inconsistent time-intervals
X-axis dates with inconsistent time-intervals
Post Reply
X-axis dates with inconsistent time-intervals
View
Flat Ascending
Flat Descending
Threaded
Options
Subscribe to topic
Print This Topic
Goto Topics Forum
Author
Message
Vahid Mesri
Vahid Mesri
posted 8 Years Ago
ANSWER
Topic Details
Group: Forum Members
Posts: 11,
Visits: 67
Hi,
In my smooth-line plot, the x-values are dates and the y-values are percentages.
The issue is that I have monthly values at the beginning section of my plot, however, after two years, the dates are updated on yearly basis, therefore the dates do not have consistent intervals.
Please find attached the plot I've created using the Microsoft chart control. I would like to use Nevron to reproduce this plot but unfortunately it treats the dates as categories and not datetime variables.
Thanks a lot for your help
Tags
date
inconsistentcy
scale
x-axis
Reply
Like
0
Nevron Support
Nevron Support
posted 8 Years Ago
ANSWER
Post Details
Group: Administrators
Posts: 3.1K,
Visits: 4.2K
Hello Vahid,
This is caused by the default axis scaling. You can use the following custom C# code:
using System;
using System.Drawing;
using Nevron.GraphicsCore;
using Nevron.Chart;
using Nevron.ReportingServices;
namespace MyNamespace
{
/// <summary>
/// Sample class
/// </summary>
public class MyClass
{
/// <summary>
/// Main entry point
/// </summary>
/// <param name="context"></param>
public static void RSMain(NRSChartCodeContext context)
{
NChart chart = context.document.Charts[0];
NDateTimeScaleConfigurator dateTimeScale = chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator as NDateTimeScaleConfigurator;
if (dateTimeScale != null)
{
bool hasMin = false;
DateTime minValue = new DateTime();
foreach (NSeriesBase series in chart.Series)
{
NXYScatterSeries xyScatter = series as NXYScatterSeries;
if (xyScatter != null && xyScatter.XValues.Count > 0)
{
DateTime curXValue = DateTime.FromOADate((double)xyScatter.XValues[0]);
if (hasMin)
{
minValue = minValue < curXValue ? minValue : curXValue;
}
else
{
hasMin = true;
minValue = curXValue;
}
}
}
if (hasMin)
{
dateTimeScale.UseOrigin = true;
dateTimeScale.Origin = new DateTime(minValue.Year, minValue.Month, 1, 0, 0, 0);
}
}
}
}
}
Best Regards,
Nevron Support Team
Reply
Like
1
GO
Merge Selected
Merge into selected topic...
Merge into merge target...
Merge into a specific topic ID...
Open Merge
Post Reply
Similar Topics
Post Quoted Reply
Reading This Topic
Login
Login
Remember Me
Reset Password
Resend Validation Email
Login
Explore
Messages
Mentions
Search