* UILineChart: 增加了Y轴数据由上向下绘制
This commit is contained in:
parent
bc9e2effe5
commit
4cf7239d07
@ -820,6 +820,8 @@ namespace Sunny.UI
|
|||||||
}
|
}
|
||||||
|
|
||||||
int idx = 0;
|
int idx = 0;
|
||||||
|
float xmin = -9999;
|
||||||
|
float ymin = Option.Grid.Top + 4;
|
||||||
if (XScale != null)
|
if (XScale != null)
|
||||||
{
|
{
|
||||||
foreach (var line in Option.XAxisScaleLines)
|
foreach (var line in Option.XAxisScaleLines)
|
||||||
@ -835,19 +837,25 @@ namespace Sunny.UI
|
|||||||
pn.DashPattern = new float[] { 3, 3 };
|
pn.DashPattern = new float[] { 3, 3 };
|
||||||
}
|
}
|
||||||
|
|
||||||
g.DrawLine(pn, pos, DrawOrigin.Y - 1, pos, Option.Grid.Top + 1);
|
g.DrawLine(pn, pos, Height - Option.Grid.Bottom - 1, pos, Option.Grid.Top + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
Size sf = TextRenderer.MeasureText(line.Name, TempFont);
|
Size sf = TextRenderer.MeasureText(line.Name, TempFont);
|
||||||
float x = pos - sf.Width;
|
float x = pos - sf.Width;
|
||||||
if (x < Option.Grid.Left) x = pos + 2;
|
if (x < Option.Grid.Left) x = pos + 2;
|
||||||
float y = Option.Grid.Top + 4 + sf.Height * idx;
|
float y;
|
||||||
|
if (x > xmin)
|
||||||
|
y = ymin;
|
||||||
|
else
|
||||||
|
y = ymin + sf.Height;
|
||||||
|
|
||||||
if (y > Height - Option.Grid.Bottom)
|
if (y > Height - Option.Grid.Bottom)
|
||||||
{
|
{
|
||||||
idx = 0;
|
y = Option.Grid.Top + 4;
|
||||||
y = Option.Grid.Top + 4 + sf.Height * idx;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
xmin = x + sf.Width;
|
||||||
|
ymin = y;
|
||||||
idx++;
|
idx++;
|
||||||
g.DrawString(line.Name, TempFont, line.Color, new Rectangle((int)x, (int)y, Width, Height), ContentAlignment.TopLeft);
|
g.DrawString(line.Name, TempFont, line.Color, new Rectangle((int)x, (int)y, Width, Height), ContentAlignment.TopLeft);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user