Hi, I am using RadControls for WinForms SP2 (Q2 2010) and trying to render a stock price line chart, of which each price is a daily price. The prices are rendering ok however I have an issue with the x axis which I believe is affecting how the data is ultimately rendered.
Each item in the series is a daily price for the given stock, along with the date on which the price relates to. On the X axis we want to just show monthly points, so for our example where we are rendering a chart of daily stock prices, each axis label on the x axis would show the month (Jan, Feb, Mar etc). The code we are using (VB.net) to set the x axis label is:
chrtVBA.PlotArea.XAxis.AddRange(xMin, xMax, 30)
…where xMin and xMax are the minimum and maximum dates in the series (converted using .ToOADate()).
As you can see, we are specifying 30 as the step value, however I beleive that because there aren’t 30 days in every month the X axis labels becomes out of sync with the plotted points. Is there a specific method to call or property we can set so that the x axis correctly shows the correct month?
I have attached an example of what the chart currently looks like, we have checked the stock prices and they do appear to be out of sync with the x axis, for example a price which appears to be for late August on the rendered chart should be showing for early September. For information; the xMin and xMax values used to render this chart were 09/12/2010 and 09/12/2011 respectively (not We did call .ToOADate() to convert.
Thanks for you help.
Michael
if (row.Cells[e.ColumnIndex].CellElement != null) CellElement is null and is that last row in view when the grid loads. So my code below only works for rows in view.
Let me state exactly what I'm trying to do. If nothing else please help me find the correct solution.
I have a Winforms RadGridView table with GridViewCheckBoxes in a column. When a user selects a checkbox in a row i want all the rest of the checkboxes in the other rows to be disabled. When the user unchecks the checkboxed row I want all checkboxes in other rows to be enabled. It's simple, only one checkbox in a row can be selected.
public bool HandleCellValueChanged(RadGridView matrixRadGrid, GridViewCellEventArgs e, MatrixPickerPresenter matrixPresenter, RadGridView measureGrid)
{
bool IsValidSelection = false;
if (reportType == CustomReportTypes.Matrix || reportType == CustomReportTypes.MatrixRowWithHistory || reportType == CustomReportTypes.MatrixWithHistory)
{
if (e.Column.HeaderText == "Selected")
{
measureGrid.DataSource =
null;
if (matrixPresenter.Measures.Count > 0)
{
measureGrid.Enabled =
true;
measureGrid.DataSource = matrixPresenter.Measures;
try
{
var displayRow =
measureGrid.Rows.Where(row => ((
ReportMeasure)row.DataBoundItem).IsDisplayMeasure).FirstOrDefault();
if (displayRow != null)
{
// The Display Measure must be in view for the RowFormatting event to fire and the user needs to know what the Display Measure is at the start.
measureGrid.GridElement.ScrollToRow(displayRow);
}
}
catch
{
// Do nothing: No need to end the world just because the Display Measure isn't in view.
;
}
}
else
{
measureGrid.Enabled =
false;
}
IsValidSelection = measureGrid.Enabled;
var selectedReportItem = e.Row.DataBoundItem as ReportMatrix;
if (selectedReportItem != null)
{
bool enableOtherSelectedCheckboxes = true;
if (selectedReportItem.Selected)
{
enableOtherSelectedCheckboxes =
false;
IsValidSelection =
true;
}
for (int index = 0; index < matrixRadGrid.Rows.Count; index++)
{
var row = matrixRadGrid.Rows[index];
if (e.RowIndex == index)
{
if (!selectedReportItem.Selected)
{
selectedReportItem.MatrixParameter = (
int)MatrixParameterTypes.None;
e.Row.Cells[e.ColumnIndex + 1].Value = (
int)MatrixParameterTypes.None;
}
continue;
}
matrixRadGrid.GridElement.ScrollToRow(row);
if (row.Cells[e.ColumnIndex].CellElement != null)
{
row.Cells[e.ColumnIndex].CellElement.Enabled = enableOtherSelectedCheckboxes;
}
}
}
}
else if (e.Column.HeaderText == "Runtime Parameter")
{
bool setEnabled = true;
var reportMatrix = e.Row.DataBoundItem as ReportMatrix;
if (reportMatrix != null && reportMatrix.Selected)
{
setEnabled =
false;
IsValidSelection =
true;
measureGrid.Enabled =
true;
}
for (int index = 0; index < matrixRadGrid.Rows.Count; index++)
{
var row = matrixRadGrid.Rows[index];
if (e.RowIndex == index)
{
continue;
}
row.Cells[e.ColumnIndex].CellElement.Enabled = setEnabled;
}
}
}
return IsValidSelection;
}
}
Private
Sub
RadGridView1_ChildViewExpanding(
ByVal
sender
As
System.
Object
,
ByVal
e
As
Telerik.WinControls.UI.ChildViewExpandingEventArgs)
Handles
RadGridView1.ChildViewExpanding
'RadGridView1.Templates.GetTemplateByCaption(e.ParentRow.ActiveView.ViewTemplate.Caption)
Dim
stemplate
As
String
If
e.IsExpanded =
False
Then
For
Each
row
As
GridViewRowInfo
In
RadGridView1.Rows
If
(row.IsExpanded =
True
)
Then
stemplate =
DirectCast
(row, Telerik.WinControls.UI.GridViewHierarchyRowInfo).ActiveView.ViewTemplate.Caption
Exit
For
End
If
Next
End
If
End
Sub