ramnathv / rMaps

Interactive Maps from R
http://rmaps.github.io
389 stars 194 forks source link

Add Custom HTML #65

Open yooper opened 10 years ago

yooper commented 10 years ago

Hello,

Is is possible to inject HTML into the template prior to the rMap being saved to disk? I know you can add custom css and custom js files through the addAssests function call. Is there something similar for HTML?

ramnathv commented 10 years ago

Yes. Can you elaborate more on what library you are using and what is the HTML you are trying to insert?

yooper commented 10 years ago

Here is my description of the problem I am trying to solve.

The Issue

I have a data frame that has a year, a county name, and 40 columns with demographic data counts. For each demographic count I want to produce a separate choropleth map, with a slider for each year, I have data. If I were to try and put all the data into a single web page, the web page would be 4+ megabytes.

A Solution

rMaps should have the ability to add in a HTML, such as a drop down menu, to each rMap, prior to it being written to disk, or outputted. For me, I will create a drop down menu that allows an end user to select a data set to view, and upon change will redirect the end user to a different rMap web page.

Additional Ideas

If the rMap object had a way to write HTML to the template, for example, access to the header and footer portions of the template, it would make it easier to brand/customize the look and feel of the outputted rMap web page.

BTW, rMaps is very awesome. Thank you for putting it together.

yooper commented 10 years ago

After looking through the source code, I can see the afterScript provides some of the functionality I am looking for. What is your approach to breaking the dependency on rCharts templates? Are you going to create a separate template system withing rMaps, keep the dependency on rCharts, make a template repo for use rMaps and rCharts? I am open to contributing to this task.