DotNet.Highcharts

Topics: Troubleshooting, Writing modules
Feb 6, 2014 at 2:46 PM
Edited Feb 6, 2014 at 2:48 PM
I am trying to add a partial view to a standard MVC (not Orchard -y) module using DotNet.Highcharts. I have installed the Highcharts package to both the module and to the Orchard solution. I have added the necessary references and yet when the partial view is inserted into the View the call to Highcharts is undefined.
<div id='chart_container'></div> <script type='text/javascript'>
Highcharts.setOptions({ colors: ['#DDDF0D', '#7798BF', '#55BF3B', '#DF5353', '#DDDF0D', '#AAEEEE', '#FF0066', '#EEAAEE'] });

I am using the pjs.bootstrap theme. On my regular MVC project I was able to add the references:
<script src="~/Scripts/jquery-1.8.2.min.js" type="text/javascript"> </script>
<script src="~/Scripts/Highcharts-3.0.1/js/highcharts.js" type="text/javascript">      </script>
to the _Layout.cshtml file and everything works fine. But in my Orchard module this file is apparently not called.

I am using the 1.x branch downloaded on Jan 26. as that was the only way I could get full intellisense in VS 2013

What am I missing?

Thanks in advance for any help.
Feb 6, 2014 at 3:54 PM
You can use a resource manifest to be able to "Script.Require" the js file in you views.

See https://orchardtrainingdemo.codeplex.com/SourceControl/latest#ResourceManifest.cs to find out how to declare the manifest.

See https://orchardtrainingdemo.codeplex.com/SourceControl/latest#Views/TrainingDemo.PersonListDashboard.cshtml to find out how to use Script.Require with it.


Feb 6, 2014 at 5:21 PM
I now have a ResourceManifest

public void BuildManifests(ResourceManifestBuilder builder)
    {
        var manifest = builder.Add();

        manifest
            .DefineScript("Charts.Highcharts")             
            .SetUrl("Highcharts-3.0.1/js/highcharts.js")          
            .SetDependencies("jQuery");

        manifest
            .DefineScript("Charts.js1.82")
            .SetUrl("jquery-1.8.2.min.js")
            .SetDependencies("jQuery");
and in my view
{
Script.Require("Charts.js1.82");
Script.Require("Charts.Highcharts");
}

but Highcharts still is undefined at runtime.

I tried to use .Type to set the type="text/javascript" portion but with or without it does not work .

Am I doing properly?

Thank you again in advance
Feb 7, 2014 at 6:56 PM
I think I found the problem. It seems that Orchard was not searching into the Scripts/Highcharts folder to sear for the script.

Thanks for the help.