バージョン

LabelHash プロパティ (UltraChart)

チャートのカスタムラベルのハッシュテーブルを取得または設定します。
シンタックス
'宣言
 
Public Property LabelHash As Hashtable
public Hashtable LabelHash {get; set;}
使用例
UltraChart1.Tooltips.Format = TooltipStyle.Custom
UltraChart1.Tooltips.FormatString = "<MY_VALUE>"
Dim MyLabelHashTable as New Hashtable
MyLabelHashTable.Add("MY_VALUE", New MyLabelRenderer)
UltraChart1.LabelHash = MyLabelHashTable

' ... 

Public Class MyLabelRenderer
	Implements IRenderLabel
	Public OverLoads Function ToString(ByVal Context As Hashtable) As String Implements IRenderLabel.ToString
		Select Case CDbl(Context("DATA_VALUE"))
			Case Is > 1000
				Return CStr(Context("DATA_VALUE")) & " [Very High]"
			Case Is > 100
				Return CStr(Context("DATA_VALUE")) & " [High]"
			Case Is > 10
				Return CStr(Context("DATA_VALUE")) & " [Medium]"
			Case Is >= 0
				Return CStr(Context("DATA_VALUE")) & " [Low]"
			Case Else
				Return CStr(Context("DATA_VALUE")) & " [Negative]"
		End Select
	End Function
End Class
UltraChart1.Tooltips.Format = TooltipStyle.Custom;
UltraChart1.Tooltips.FormatString = "<MY_VALUE>";
Hashtable MyLabelHashTable = new Hashtable();
MyLabelHashTable.Add("MY_VALUE", new MyLabelRenderer());
UltraChart1.LabelHash = MyLabelHashTable;

// ... 

public class MyLabelRenderer : IRenderLabel
{
	public string ToString(Hashtable Context)
	{
		double dataValue = (double)Context["DATA_VALUE"];
		if (dataValue > 1000)
			return (string)Context["DATA_VALUE"] + " [Very High]";
		else if (dataValue > 100)
			return (string)Context["DATA_VALUE"] + " [High]";
		else if (dataValue > 10)
			return (string)Context["DATA_VALUE"] + " [Medium]";
		else if (dataValue >= 0)
			return (string)Context["DATA_VALUE"] + " [Low]";
		else		
			return (string)Context["DATA_VALUE"] + " [Negative]";
	}
}
参照