TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Neilsie Neil
NA
1
1.7k
C# VS Web application error, problem with Interface implementation usage
Mar 21 2012 7:17 PM
Im really new one here, because I thought I`ll manage to solve any problem just by looking for them on these blogs but havent encautered anything similar, hence required help :
I got this C# code in one class:
public class PageLoad
{
public interface IPlotDataSource // interface that declares all the methods / properties I want a data source for the plot to have
{
List<ChartPoint> GetData(string[] tags, DateTime start, DateTime end);
}
public class RandomPlotDataSource : IPlotDataSource // class which implements the interface that will generate random plot data
{
public List<ChartPoint> GetData(string[] tags, DateTime start, DateTime end)
{
List<ChartPoint> listDataSource = new List<ChartPoint>();
int c =500;
for (int i = 1; i < c; i++)
{
listDataSource.Add(new ChartPoint(i, i));
}
return listDataSource;
}
}
/* public class ProfecyPlotDataSource : IPlotDataSource //a class that implements the interface that will retrieve the data from Profecy
{
public List<ChartPoint> GetData(string[] tags, DateTime start, DateTime end)
{
//query profecy for tag data here
}
//return;
}*/
public static void DoPlot(IPlotDataSource dataSource, string[] tags, DateTime start, DateTime end, Chart chart) //plotting class
{
//my dataSource parameter can be an instance of any class that implements the IPlotDataSource
//interface either an instance of RandomPlotDataSource or ProfecyPlotDataSource
var points = dataSource.GetData(tags, start, end);
var c = points.Count;
var plottingTool = new PlottingTool();
double colorCounter = 250; // double can be null
double step = colorCounter / c;
foreach (var point in points)
{
plottingTool.AddNewSeries(point, chart, Color.FromArgb(Convert.ToInt32(colorCounter), Convert.ToInt32(colorCounter), Convert.ToInt32(colorCounter)));
colorCounter -= step;
}
chart.Width = 800;
chart.Height = 500;
chart.ChartAreas["ChartArea1"].AxisX.Maximum = 700;
chart.ChartAreas["ChartArea1"].AxisX.Minimum = 0;
chart.ChartAreas["ChartArea1"].AxisX.Interval = 100;
chart.ChartAreas["ChartArea1"].Area3DStyle.Enable3D = false;
chart.ChartAreas["ChartArea1"].AxisY.Maximum = 600;
chart.ChartAreas["ChartArea1"].AxisY.Minimum = 150;
chart.ChartAreas["ChartArea1"].AxisY.Interval = 50;
chart.ChartAreas["ChartArea1"].Area3DStyle.Enable3D = false;
chart.ChartAreas["ChartArea1"].AxisX.Title = "Flow";
chart.ChartAreas["ChartArea1"].AxisY.Title = "Total Head";
}
}
this is the class which defines interface. and everything is fine with it , but then in my main class i try to call RandomPlotDataSource to get my random x,y points and then pass it to function DoPlot with code below :
public static void Page_Load(object sender, System.EventArgs e)
{
Pump_Monitor.PageLoad.IPlotDataSource datasource = new Pump_Monitor.PageLoad.RandomPlotDataSource(); //create a new instance
datasource.GetData(tags, start, end);
PageLoad.DoPlot(datasource, tags, start, end, chart);
}
but nothing really happens.
Please any help will be apreciated.
Thank You , Neil.
Reply
Answers (
0
)
While downloading excel file in IE browser getting an error "The connection with server was reset"
C# Report viewer doesn't refresh on data changes (SOLVED)