Preventing connection to JS files on Steema webpage

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
PeterF
Newbie
Newbie
Posts: 6
Joined: Wed Sep 27, 2017 12:00 am
Location: Kosice, Slovakia

Preventing connection to JS files on Steema webpage

Post by PeterF » Mon Oct 30, 2017 11:45 am

Hello, guys I would like to ask you about specific problem, that I am dealing with.

I am programming statistics and charts on our intranet portal, where users have to authenticate yourself to make connection to the internet.
The problem is, when I ran one of your sample project for example (JLineChart.aspx from JScript-HTML 5 Live Charts folder) I had to fill my IDs twice.
I found in 'View source' option of current web page something like this:

<input type="hidden" name="__VIEWSTATEGENERATOR" id="__VIEWSTATEGENERATOR" value="9CBF2F08" />
<script src="http://www.steema.com/files/public/teec ... eechart.js" type="text/javascript"></SCRIPT>
<script src="http://www.steema.com/files/public/teec ... -extras.js" type="text/javascript"></SCRIPT>

So teechart was trying to connect to internet to make a reference to these scripts.
But I can not require from our end users to fill their password and username twice, every time they want to display charts.
I need to include these scripts locally to my projects. I tried to find something on this topic, but without success yet.

Do you have any solution for these kind of scenarios?

Thank you

Yeray
Site Admin
Site Admin
Posts: 9612
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Preventing connection to JS files on Steema webpage

Post by Yeray » Tue Oct 31, 2017 8:51 am

Hello,
PeterF wrote:I need to include these scripts locally to my projects. I tried to find something on this topic, but without success yet.
You can download those .js, place them to a folder next to your project and change those references for relative references. Ie:

Code: Select all

<script src="../TeeChart_v2014.04.28.1.6/teechart.js" type="text/javascript"></SCRIPT>
<script src="../TeeChart_v2014.04.28.1.6/teechart-extras.js" type="text/javascript"></SCRIPT>
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

PeterF
Newbie
Newbie
Posts: 6
Joined: Wed Sep 27, 2017 12:00 am
Location: Kosice, Slovakia

Re: Preventing connection to JS files on Steema webpage

Post by PeterF » Tue Oct 31, 2017 11:50 am

Hello Yeray,

I should mention it, that it was first thing I tried to locally include these scripts to my solution.
These lines are automatically generated by object on server side.

<script src="http://www.steema.com/files/public/teec ... eechart.js" type="text/javascript"></SCRIPT>
<script src="http://www.steema.com/files/public/teec ... -extras.js" type="text/javascript"></SCRIPT>

Yeray
Site Admin
Site Admin
Posts: 9612
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Preventing connection to JS files on Steema webpage

Post by Yeray » Fri Nov 03, 2017 8:46 am

Hello,

If you are generating those (.html) files exporting a Chart created with TeeChart .NET, you could edit that output using a Streams, and modify the references substituting that absolute&external path for your relative&internal path.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

PeterF
Newbie
Newbie
Posts: 6
Joined: Wed Sep 27, 2017 12:00 am
Location: Kosice, Slovakia

Re: Preventing connection to JS files on Steema webpage

Post by PeterF » Tue Nov 07, 2017 8:47 am

Yeray,

I am not sure if I understand, what you mean by "edit that output using a Streams, .....". Search pages about Streams in C#, but nothing about redirecting a references from external to internal paths.
There is no option for us to read from those references externally.

It would be perfect, if you could edit your example, that I uploaded, to make things work, without requiring an external connection.

Thank you.

Peter Fercak
Attachments
JScript-HTML5 Live Charts.zip
(3.41 KiB) Downloaded 909 times

Yeray
Site Admin
Site Admin
Posts: 9612
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Preventing connection to JS files on Steema webpage

Post by Yeray » Tue Nov 07, 2017 9:24 am

Hello Peter,
PeterF wrote:I am not sure if I understand, what you mean by "edit that output using a Streams, .....". Search pages about Streams in C#, but nothing about redirecting a references from external to internal paths.
There is no option for us to read from those references externally.
I assumed you were generating a .html file and I suggested you could edit it and modify the reference in there.
However I missed an easier way:
  • Download teechart.js and teechart-extras.js:
    - v2014 version you were using: teechart.js and teechart-extras.js.
    - Latest: teechart.js and teechart-extras.js.
  • Put those .js files somewhere in the folder structure of your web application. Ie, at "Interacting with Charts\JScript-HTML5 Live Charts" folder.
  • Add a line of code to your charts to tell where the .js are relatively to the current .cs. Ie, at the end of your JLineChart.aspx.cs:

    Code: Select all

          ch1.Export.Image.JScript.SourceScriptPath = "";
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

PeterF
Newbie
Newbie
Posts: 6
Joined: Wed Sep 27, 2017 12:00 am
Location: Kosice, Slovakia

Re: Preventing connection to JS files on Steema webpage

Post by PeterF » Wed Nov 08, 2017 8:49 am

You were right Yeray, its working now. Thank you.
Don't you know, when I replace tchart server control from example:

Code: Select all

<tchart:WebChart id="WebChart1" 
 runat="server" Config="..."
TempChart="Session" AutoPostback="False" 
GetChartFile="GetChart.aspx" PictureFormat="JScript" 
Height="300px" Width="900px"></tchart:WebChart>
and use WebChart control from Toolbox with same values, I get an error about "Object reference not set to an instance of an object."

PeterF
Newbie
Newbie
Posts: 6
Joined: Wed Sep 27, 2017 12:00 am
Location: Kosice, Slovakia

Re: Preventing connection to JS files on Steema webpage

Post by PeterF » Wed Nov 08, 2017 12:51 pm

I find out, that I need to leave "style" option for tchart. If I delete for example position or z-index I will get an error.

Code: Select all

style="Z-INDEX: 107; LEFT: 400px; POSITION: relative; TOP: 15px;"

Yeray
Site Admin
Site Admin
Posts: 9612
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Preventing connection to JS files on Steema webpage

Post by Yeray » Thu Nov 09, 2017 11:53 am

Hello,
PeterF wrote:You were right Yeray, its working now. Thank you.
I'm glad to hear that!
PeterF wrote:I find out, that I need to leave "style" option for tchart. If I delete for example position or z-index I will get an error.
I can't reproduce that error removing the full "style" line in JLineChart.aspx.
I've tested it in IE 11.15.16299.0 and in Firefox 56.0.2.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply