# Running JSROOT From Local Server and setting histogram titles

**URL:** <https://root-forum.cern.ch/t/running-jsroot-from-local-server-and-setting-histogram-titles/56619>\
**Category:** Newbie\
**Tags:** jsroot\
**Created:** [October 5, 2023, 4:20pm UTC](https://root-forum.cern.ch/t/running-jsroot-from-local-server-and-setting-histogram-titles/56619 "2023-10-05T16:20:49Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![trainroot](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/t/d6d6ee/32.png) [@trainroot](https://root-forum.cern.ch/u/trainroot)\
**Post date:** [October 5, 2023, 4:20pm UTC](https://root-forum.cern.ch/t/running-jsroot-from-local-server-and-setting-histogram-titles/56619/1 "2023-10-05T16:20:49Z")

</div>

Hello All,  
I am new to root and am trying to draw a histogram using JSROOT. I have a two questions:

1. Everything works when calling the js files from cern servers, but not from local servers.  
I cloned the repo from jsroot github, am on the main branch, and can individually access the js files (just to ensure that the local server settings works)

```auto
 import { openFile } from 'https://root.cern/js/latest/modules/io.mjs';
 import { redraw,draw } from 'https://root.cern/js/latest/modules/draw.mjs';

 // import { openFile } from 'http://server/html/jsroot/modules/io.mjs';
 // import { draw } from 'http://server/html/jsroot/modules/draw.mjs';

```

How do I use the js files from a local server? I understand this may be more a front-end web question, but just in case someone encountered the same issue. The exact error when calling js files from local server is (from firefox console) is:

`Uncaught (in promise) SyntaxError: ambiguous indirect export: setHistTitle`

1. After drawing a histogram, how do you set the labels (title, xlabel, ylabel etc). I am drawing the histogram thusly:

```auto
let ntuples = await file.readObject("ntuples;1");
let hist = draw("drawing", ntuples, "px:py:pz");
// hist.fTitle="asfsd"; //This does not work.

```

Thank you,

* * *

_ROOT Version:_ NA jsroot.git master  
_Platform:_ Browser  
_Compiler:_ NA

* * *

---

<div class="post-metadata">

**Author:** ![bellenot](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/bellenot/32/29217_2.png) [@bellenot](https://root-forum.cern.ch/u/bellenot)\
**Post date:** [October 5, 2023, 8:26pm UTC](https://root-forum.cern.ch/t/running-jsroot-from-local-server-and-setting-histogram-titles/56619/2 "2023-10-05T20:26:03Z")

</div>

Welcome to the ROOT Forum!  
I’m sure @linev can help you

---

<div class="post-metadata">

**Author:** ![linev](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/l/2bfe46/32.png) [@linev](https://root-forum.cern.ch/u/linev)\
**Post date:** [October 11, 2023, 12:56pm UTC](https://root-forum.cern.ch/t/running-jsroot-from-local-server-and-setting-histogram-titles/56619/3 "2023-10-11T12:56:52Z")

</div>

Hi,

It should not be a difference if you are using JSROOT from `root.cern` website or from local.  
Error with `setHistTitle` is strange - such function is not defined in JSROOT. Do you have it in your sources?

About second question - this is not a proper way.  
As a result of tree/tuple drawing one gets promise with painter of produced object.  
To change title, one should do:

```auto
let painter = await draw("drawing", ntuples, "px:py:pz");
painter.getObject().fTitle = "custom title";
painter.redrawPad();

```

Please try this code.
