internal void Update(Graphics g)
{
if (this.chart.MainSeries == null || this.chart.MainSeries.Count == 0)
return;
Graphics = g;
if (MinValue != double.MaxValue && MaxValue != double.MinValue)
{
Axis.Paint();
g.SetClip(new Rectangle(X1, Y1, this.width, this.height));
foreach (IChartDrawable drawable in this.simplePrimitives)
if (DrawItems || drawable is SeriesView)
drawable.Paint();
if (DrawItems)
{
int nextIndex = this.rangeList.GetNextIndex(this.chart.MainSeries.GetDateTime(this.chart.FirstIndex));
int prevIndex = this.rangeList.GetPrevIndex(this.chart.MainSeries.GetDateTime(this.chart.LastIndex));
if (nextIndex != -1 && prevIndex != -1)
for (int i = nextIndex; i <= prevIndex; ++i)
foreach (IChartDrawable drawable in this.rangeList[i])
drawable.Paint();
}
g.ResetClip();
}
float num = X1 + 2f;
string legend = null;
foreach (IChartDrawable drawable in this.simplePrimitives)
{
if (drawable is SeriesView)
{
var sView = drawable as SeriesView;
if (sView.DisplayNameEnabled)
{
legend = legend == null ? sView.DisplayName : " " + sView.DisplayName;
var size = g.MeasureString(legend, this.chart.Font);
g.FillRectangle(new SolidBrush(this.chart.CanvasColor), num + 2f, Y1 + 2f, size.Width, size.Height);
g.DrawString(legend, this.chart.Font, new SolidBrush(sView.Color), num + 2f, Y1 + 2f);
num += size.Width;
}
}
}
if (this.outlineEnabled)
g.DrawRectangle(new Pen(Color.Green), this.outlineRectangle);
}