Jan 13, 2014, 6:27 PM
chart numeric highlights staying on screen after switching tab
Presently, I have a chart with three tabs, so when I go to the first tab, the numbers highlight the chart appropriately; however, when I go to the second tab, the numeric highlights from the first tab still show up. This is not acceptable for a production environment. Please see the attached images. Does anyone have any suggestions?
Here is the aspx code:
Here is the aspx code:
<ext:Chart ID="Chart3" runat="server" Animate="true">
<Store>
<ext:Store ID="Store3" runat="server">
<Model>
<ext:Model ID="Model4" runat="server">
<Fields>
<ext:ModelField Name="Name" />
<ext:ModelField Name="Normal" />
<ext:ModelField Name="Optimistic" />
</Fields>
</ext:Model>
</Model>
</ext:Store>
</Store>
<Axes>
<ext:CategoryAxis Position="Bottom" Fields="Name" Title="Year" />
<ext:NumericAxis Title="Data (blue)" Fields="Normal" Position="Left" Minimum="0">
<LabelTitle Fill="#115fa6" />
<Label Fill="#115fa6" />
</ext:NumericAxis>
<ext:NumericAxis Title="Data (green)" Fields="Optimistic" Position="Right" Minimum="0">
<LabelTitle Fill="#94ae0a" />
<Label Fill="#94ae0a" />
</ext:NumericAxis>
</Axes>
<Series>
<ext:LineSeries Titles="Blue Line" XField="Name" YField="Normal" Axis="Left" Smooth="3">
<HighlightConfig Size="7" Radius="7" />
<MarkerConfig Size="4" Radius="4" StrokeWidth="0" />
</ext:LineSeries>
<ext:LineSeries Titles="Green Line" XField="Name" YField="Optimistic" Axis="Right"
Smooth="3">
<HighlightConfig Size="7" Radius="7" />
<MarkerConfig Size="4" Radius="4" StrokeWidth="0" />
</ext:LineSeries>
</Series>
<Plugins>
<ext:VerticalMarker ID="VerticalMarker1" runat="server">
<XLabelRenderer Handler="return Ext.util.Format.date(value + 1, 'y');" />
</ext:VerticalMarker>
</Plugins>
<LegendConfig Position="Bottom" />
</ext:Chart>
Here is the C# code that creates the chart and updates the labels: protected void ReloadData3(object sender, DirectEventArgs e)
{
Store store = this.Chart3.GetStore();
store.DataSource = LineChartData.GenerateData(Convert.ToInt32(ddlTechnicalDriverCond.SelectedItem.Value), Convert.ToInt32(ddlFieldCond.SelectedItem.Value), Convert.ToInt32(ddlProjectCond.SelectedItem.Value));
store.DataBind();
this.ChangeChartLabel();
this.Chart3.ReRender();
}
public static List<LineChartData> GenerateData(int _IdTechnicalDriver, int _IdField, int _IdProject)
{
DataClass.clsTechnicalDriverData oTechnicalDriver1 = new DataClass.clsTechnicalDriverData();
DataTable dt = oTechnicalDriver1.LoadList("IdProject = '" + _IdProject + "' AND IdField = '" + _IdField + "' AND IdTechnicalDriver = '" + _IdTechnicalDriver + "'", "");
List<LineChartData> data = new List<LineChartData>(dt.Rows.Count);
Int32 intYear = DateTime.Now.Year;
foreach (DataRow objRow in dt.Rows)
{
string strDriver1Baseline = objRow["Normal"].ToString() != "" ? objRow["Normal"].ToString() : null;
string strDriver1Optimistic = objRow["Optimistic"].ToString() != "" ? objRow["Optimistic"].ToString() : null;
string strDriver1Pessimistic = objRow["Pessimistic"].ToString() != "" ? objRow["Pessimistic"].ToString() : null;
data.Add(new LineChartData
{
Name = Convert.ToString(intYear),
Normal = Convert.ToDouble(strDriver1Baseline),
Optimistic = Convert.ToDouble(strDriver1Optimistic),
Pessimistic = Convert.ToDouble(strDriver1Pessimistic)
});
intYear++;
}
return data;
}
}
private void ChangeChartLabel()
{
// Other code...
// Change Chart 3 (the middle chart) labels:
this.Chart3.Axes.RemoveAt(1);
this.Chart3.Axes.RemoveAt(1);
this.Chart3.Axes.Add(axis1);
this.Chart3.Axes.Add(axis2);
var lineSeries1 = this.Chart3.Series[0];
var lineSeries2 = this.Chart3.Series[1];
lineSeries1.Titles[0] = strTechnicalDriver1Unit;
lineSeries2.Titles[0] = strTechnicalDriver2Unit;
this.Chart3.Series.RemoveAt(0);
this.Chart3.Series.RemoveAt(0);
this.Chart3.Series.Add(lineSeries1);
this.Chart3.Series.Add(lineSeries2);
}
Last edited by rmoore; Jan 13, 2014 at 6:34 PM.
Reason: added more info, code and images