This is a migrated thread and some comments may be shown as answers.

HTML Canvas --RGraph

1 Answer 76 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Hanson
Top achievements
Rank 1
Hanson asked on 20 Feb 2012, 07:24 AM
Hello ,

I'm using the following code to obtain the canvas object:

var bar1 = Find.ById<HtmlCanvas>("bar1");

my question is , how can I verify the content in this object ?

for example of my code:
bar3 = new RGraph.Bar('bar1', [health, warning, totalServer - health - warning]);
bar3.Set('chart.labels', ['Health', 'Warning', 'Error']);
bar3.Set('chart.tooltips', function (idx) { return '<b>' + bar3.Get('chart.labels')[idx] + '</b>'; });
bar3.Set('chart.colors', ['green', 'gold', 'red']);
bar3.Set('chart.colors.sequential', true);
  
//bar3.Set('chart.title', 'Total Instances');
bar3.Set('chart.hmargin', 28);
bar3.Set('chart.labels.above', true);
bar3.Set('chart.title.xaxis.size', 3);
bar3.Draw();

How can I verify the "chart" since i got the HtmlCanvas object ?

Thanks,
Hanson Wang

1 Answer, 1 is accepted

Sort by
0
Plamen
Telerik team
answered on 23 Feb 2012, 01:45 PM
Hello Hanson,

I'm not sure what is the exact verification you want to perform against the HTMLCanvas object. All members of the HTMLCanvas class are available here.

You can also use JavaScript functions in your code to access the HTMLCanvas methods and properties.
For example you can get the fill-color of the drawing or the vertical alignment of the text using the following code:
HtmlCanvas canvas = Find.ById<HtmlCanvas>("bar1");
 
//The fill-color of the drawing
canvas.GetValue<string>("getContext('2d').fillStyle");
 
//the vertical alignment of the text 
canvas.GetValue<string>("getContext('2d').textBaseline");


Kind regards,
Plamen
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
Tags
General Discussions
Asked by
Hanson
Top achievements
Rank 1
Answers by
Plamen
Telerik team
Share this question
or