Thank you hetaurhet for quick reply. If I am not wrong do you mean by class is "layout.cshtml" or "Helper.cshtml" or somthing else - -please could you explain this a little further. Do you think the .write() method may be causing any problems in displaying the chart in a particular area of the page?
var machart = new Chart(width: 400, height: 300, theme: ChartTheme.Green) .AddTitle("Whole school review") .SetXAxis("Blue bars show how many sections need to be filled in by each school", 0, 10) .SetYAxis("How much each section has been completed in percent", 0, 100) .AddSeries( chartType: "Column", markerStep: 2, xValue: dataView, xField: "Sec", yValues: dataView, yFields: "Per" ) .Write();
No. I think above code is just defining display of chart but not its position. Where exactly this razor macro is called? R you sure you have not specified any class inside the div below?
<h3>9. Assessing, recording and reporting the achievement of children and young people h3><br/>
9.1 - How does your school assess and report on the progress and achievement of children and young people in subjects relevant to their health and wellbeing?
@saif, I'm assuming the main page's markup is in a masterpage template? If so then you will need to wrap your razor call to RenderPage with <umbraco:Macro> tags, like this:
Oh, just realized I misunderstood. So you are calling this from another razor script then. Okay, then I'd agree with the others who have commented on this. It sounds like a style issue. You may want to use firebug or some other tool to inspect the elements and ensure the correct css classes are being applied to the chart.
I checked the view source in IE and FF. FF does not render the chart at all and in IE chart replaces other controls and view soruce is disabled. As you suggested I tried css but this does not effect chart position at all because in the same div i used other controls and they are displayed as css style had been written.
Render Control on .cshtml page
Hi All,
I created a razor script RealTimePieChart.cshtml which simply bind data with chart and when I render
@RenderPage("~/macroScripts/RealTimePieChart.cshtml")
</div>
It displays the chart all over the page please could you tell me how to display it only in a fixed portion of the page or bottom of the page.
kind regards
saif
Its is probably related to your css and html and not umbraco.
If you post the url to your page then you might catch someone able to help.
I am afraid at the moment our site is not accessible over the internet.
Here is the original form, all input data has been grouped in sec1,sec2 ,... and, sec9 and they reflect on the chart below
Scenario is I have to create a chart which reflects how many sections have been completed.
I tried to display the chart using renderpage as a helper.
@RenderPage("~/macroScripts/RealTimePieChart.cshtml")
Please see image below. I want to display it at the end of sections but everything disappears except the chart.
I also tried img tag.
<p> <img src="~/macroScripts/RealTimePieChart.cshtml" alt="" /></p>
any help would be really appreciated
It is actually related to class u apply or check template once in which you use this razor macro.
Thank you hetaurhet for quick reply. If I am not wrong do you mean by class is "layout.cshtml" or "Helper.cshtml" or somthing else - -please could you explain this a little further.
Do you think the .write() method may be causing any problems in displaying the chart in a particular area of the page?
var machart = new Chart(width: 400, height: 300, theme: ChartTheme.Green)
.AddTitle("Whole school review")
.SetXAxis("Blue bars show how many sections need to be filled in by each school", 0, 10)
.SetYAxis("How much each section has been completed in percent", 0, 100)
.AddSeries(
chartType: "Column",
markerStep: 2,
xValue: dataView,
xField: "Sec",
yValues: dataView,
yFields: "Per"
)
.Write();
No. I think above code is just defining display of chart but not its position. Where exactly this razor macro is called? R you sure you have not specified any class inside the div below?
<div>
@RenderPage("~/macroScripts/RealTimePieChart.cshtml")
</div>
Here is the main page's code
DOCTYPEhtml><html><headid="Head1"runat="server">head><body>
<form action=""method="post">
<divid="Q_Sec_9"style="text-align: justify; color:Blue; width:80%">
<h3>9. Assessing, recording and reporting the achievement of children and young people h3><br/>
9.1 - How does your school assess and report on the progress and achievement of children and young people in subjects relevant to their health and wellbeing?
<br/><textareaname="txt_A9p1_Sec_9"cols="100"rows="4">@wsrobj.A9p1_Sec_9textarea><br/><br/>
9.2 - How does your school celebrate the achievements of children and young people across all areas of school life?
<br/><textareaname="txt_A9p2_Sec_9"cols="100"rows="4">@wsrobj.A9p2_Sec_9textarea><br/><br/>
<div>@RenderPage("~/macroScripts/RealTimePieChart.cshtml.cshtml");
>
<p><inputtype="submit"value="Submit"/>p>
>html>
And here is the chart code I want to render on main page
bool isLoggedOn = HttpContext.Current.User.Identity.IsAuthenticated;
if(isLoggedOn){
var dfe = mdobj.GetCurrentMember().schoolName;
theDoc = wsrobj.Get_RealTimePieChart_Pivot(dfe);
var dataView = newDataView
(theDoc.DT);
var machart = newChart(width: 400, height: 300, theme: ChartTheme.Green)
.AddTitle("Whole school review")
.SetXAxis("Blue bars show how many sections need to be filled in by each school", 0, 10)
.SetYAxis("How much each section has been completed in percent", 0, 100)
.AddSeries(chartType:"Column",markerStep: 2,xValue: dataView,xField: "Sec",yValues: dataView,yFields: "Per")
.Write();
}
@saif, I'm assuming the main page's markup is in a masterpage template? If so then you will need to wrap your razor call to RenderPage with <umbraco:Macro> tags, like this:
Otherwise, razor won't know to parse it. But if this is what you're doing, why don't you make it a macro and then just call it the standard way?
Oh, just realized I misunderstood. So you are calling this from another razor script then. Okay, then I'd agree with the others who have commented on this. It sounds like a style issue. You may want to use firebug or some other tool to inspect the elements and ensure the correct css classes are being applied to the chart.
Hi Douglas,
I checked the view source in IE and FF. FF does not render the chart at all and in IE chart replaces other controls and view soruce is disabled. As you suggested I tried css but this does not effect chart position at all because in the same div i used other controls and they are displayed as css style had been written.
Any help would be really appreciated.
is working on a reply...