Skip to content

Commit

Permalink
Solved issue #8: New series are now shown in the legends even if not …
Browse files Browse the repository at this point in the history
…refreshed
  • Loading branch information
sinairv committed Jan 1, 2012
1 parent 7cf887d commit 4ac09a3
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 2 deletions.
Binary file modified Bin/MSChartWrapper.UI.exe
Binary file not shown.
Binary file modified Bin/MSChartWrapper.dll
Binary file not shown.
2 changes: 1 addition & 1 deletion MSChartWrapper.UI/FormMain.cs
Expand Up @@ -6,7 +6,7 @@ namespace MSChartWrapper.UI
{
public partial class FormMain : Form
{
private const int ArraySize = 10;
private const int ArraySize = 20;

private static readonly Random s_rnd = new Random();
private int m_numCharts = 1;
Expand Down
18 changes: 17 additions & 1 deletion MSChartWrapper/ChartWrapper.cs
Expand Up @@ -243,7 +243,7 @@ public bool LegendVisible
{
mainChart.Legends.Add(name);
}

mainChart.ChartAreas[0].Position.Width = 80.0f;
}

Expand Down Expand Up @@ -368,6 +368,10 @@ public void AddColumnPlot<T>(string name, string[] labels, T[] values)
for (int i = 0; i < labels.Length; i++)
curSeries.Points.AddXY(labels[i], values[i]);

// this will force the empty legend to show the initial plot
if (m_isLegendVisible && m_seriesNames.Count == 1)
mainChart.Legends.Add(serName);

if (m_seriesNames.Count > 1)
{
AddSideLegend(serName);
Expand All @@ -388,6 +392,7 @@ public void AddLinePlot(string name, double[] values)

string serName = name;
Series curSeries = mainChart.Series.Add(serName);

curSeries.LegendText = serName;
m_seriesNames.Add(serName);
curSeries.ChartType = SeriesChartType.FastLine;
Expand Down Expand Up @@ -426,6 +431,17 @@ public void AddLinePlot(string name, double[] values)
for (int i = 0; i < values.Length; i += markerFreq)
ptSeriesPoints.AddXY(i + 1, values[i]);
}
ptSeries.IsVisibleInLegend = true;

// this will force the empty legend to show the initial plot
if (m_isLegendVisible && m_seriesNames.Count == 1)
mainChart.Legends.Add(serName);
}
else
{
// this will force the empty legend to show the initial plot
if (m_isLegendVisible && m_seriesNames.Count == 1)
mainChart.Legends.Add(serName);
}

if (m_seriesNames.Count > 1)
Expand Down

0 comments on commit 4ac09a3

Please sign in to comment.