Style Summary Represents the style of a chart control.
Signature
Namespace cAlgo.API
Examples Example 1 (C#) Example 2 (PYTHON)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36 using cAlgo.API ;
namespace cAlgo
{
// This sample shows how to use control style to change a group of controls style instead of setting each control properties separatly
[Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
public class StyleSample : Indicator
{
protected override void Initialize ()
{
var style = new Style ();
style . Set ( ControlProperty . Margin , 5 );
style . Set ( ControlProperty . ForegroundColor , Color . Blue );
style . Set ( ControlProperty . FontSize , 14 );
style . Set ( ControlProperty . Width , 100 );
var stackPanel = new StackPanel
{
HorizontalAlignment = HorizontalAlignment . Center ,
VerticalAlignment = VerticalAlignment . Center ,
BackgroundColor = Color . Gold ,
Orientation = Orientation . Vertical
};
for ( var i = 0 ; i < 10 ; i ++ )
{
stackPanel . AddChild ( new TextBlock
{
Text = "Text Block #" + i ,
Style = style
});
}
Chart . AddControl ( stackPanel );
}
public override void Calculate ( int index )
{
}
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 import clr
clr . AddReference ( "cAlgo.API" )
from cAlgo.API import *
class Test ():
def initialize ( self ):
style = Style ()
style . Set ( ControlProperty . Margin , 5 )
style . Set ( ControlProperty . ForegroundColor , Color . Blue )
style . Set ( ControlProperty . FontSize , 14 )
style . Set ( ControlProperty . Width , 100 )
stackPanel = StackPanel ()
stackPanel . HorizontalAlignment = HorizontalAlignment . Center
stackPanel . VerticalAlignment = VerticalAlignment . Center
stackPanel . BackgroundColor = Color . Gold
stackPanel . Orientation = Orientation . Vertical
for i in range ( 10 ):
textBlock = TextBlock ()
textBlock . Text = f "Text Block # { i } "
textBlock . Style = style
stackPanel . AddChild ( textBlock )
api . Chart . AddControl ( stackPanel )
Methods Set (2) Set (1 of 2)
Summary
Provides data for the chart control Style for the specified ControlProperty and the ControlState.
Signature
public void Set ( ControlProperty property , object value , ControlState state )
Parameters
Name Type Description property ControlProperty The control property value object The property value state ControlState Control state
Return Value
void
Set (2 of 2)
Summary
Sets the chart control Style for the specified ControlProperty.
Signature
public void Set ( ControlProperty property , object value )
Parameters
Name Type Description property ControlProperty The control property value object The property value
Return Value
void
Get (2) Get (1 of 2)
Summary
Gets the chart object style for the specified ControlProperty.
Signature
public object Get ( ControlProperty property )
Parameters
Name Type Description property ControlProperty The control property
Return Value
object
Get (2 of 2)
Summary
Gets the chart control style for the specified ControlProperty and ControlState.
Signature
public object Get ( ControlProperty property , ControlState state )
Parameters
Name Type Description property ControlProperty The control property state ControlState Control state
Return Value
object
IsSuitableState Signature
private static bool IsSuitableState ( ControlState state , StyleInfo info )
Parameters
Name Type Description state ControlState info StyleInfo
Return Value
bool
Validate Signature
private ValidationResult Validate ( ControlProperty property , object value )
Parameters
Name Type Description property ControlProperty value object
Return Value
ValidationResult