mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-16 05:10:12 +00:00
增加DataZoom主题配置
This commit is contained in:
@@ -165,7 +165,7 @@ namespace XCharts
|
||||
var img = GetOrAddComponent<Image>(labelObj);
|
||||
img.color = Color.black;
|
||||
Text txt = AddTextObject("Text", labelObj.transform, font, Color.white, TextAnchor.MiddleCenter,
|
||||
new Vector2(0, 0), new Vector2(1, 1), new Vector2(1,1), sizeDelta, 16);
|
||||
new Vector2(0, 0), new Vector2(1, 1), new Vector2(1, 1), sizeDelta, 16);
|
||||
txt.GetComponent<RectTransform>().offsetMin = Vector2.zero;
|
||||
txt.GetComponent<RectTransform>().offsetMax = Vector2.zero;
|
||||
txt.text = "Text";
|
||||
@@ -535,29 +535,25 @@ namespace XCharts
|
||||
|
||||
|
||||
//获取两直线交点
|
||||
public static Vector3 GetIntersection(Vector3 lineAStart, Vector3 lineAEnd, Vector3 lineBStart, Vector3 lineBEnd)
|
||||
public static Vector3 GetIntersection(Vector3 lineAStart, Vector3 lineAEnd, Vector3 lineBStart,
|
||||
Vector3 lineBEnd)
|
||||
{
|
||||
float x1 = lineAStart.x, y1 = lineAStart.y;
|
||||
float x2 = lineAEnd.x, y2 = lineAEnd.y;
|
||||
float x3 = lineBStart.x, y3 = lineBStart.y;
|
||||
float x4 = lineBEnd.x, y4 = lineBEnd.y;
|
||||
//equations of the form x=c (two vertical lines)
|
||||
if (x1 == x2 && x3 == x4 && x1 == x3)
|
||||
{
|
||||
return Vector3.zero;
|
||||
}
|
||||
//equations of the form y=c (two horizontal lines)
|
||||
if (y1 == y2 && y3 == y4 && y1 == y3)
|
||||
{
|
||||
return Vector3.zero;
|
||||
}
|
||||
//equations of the form x=c (two vertical lines)
|
||||
if (x1 == x2 && x3 == x4)
|
||||
{
|
||||
return Vector3.zero;
|
||||
|
||||
}
|
||||
//equations of the form y=c (two horizontal lines)
|
||||
if (y1 == y2 && y3 == y4)
|
||||
{
|
||||
return Vector3.zero;
|
||||
@@ -579,14 +575,10 @@ namespace XCharts
|
||||
}
|
||||
else
|
||||
{
|
||||
//compute slope of line 1 (m1) and c2
|
||||
float m1 = (y2 - y1) / (x2 - x1);
|
||||
float c1 = -m1 * x1 + y1;
|
||||
//compute slope of line 2 (m2) and c2
|
||||
float m2 = (y4 - y3) / (x4 - x3);
|
||||
float c2 = -m2 * x3 + y3;
|
||||
//solving equations (3) & (4) => x = (c1-c2)/(m2-m1)
|
||||
//plugging x value in equation (4) => y = c2 + m2 * x
|
||||
x = (c1 - c2) / (m2 - m1);
|
||||
y = c2 + m2 * x;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user