View unanswered posts | View active topics It is currently Thu Mar 28, 2024 4:16 pm



Reply to topic  [ 5 posts ] 
Delayed rendering request 
Author Message
New pChart user
New pChart user

Joined: Thu Dec 09, 2010 5:27 pm
Posts: 3
Post Delayed rendering request
Hello

I would like to suggest a change in the delayed function, in order for it to be available on non-javascript browsers and search engine. Right now, the image url is not directly in the page so diagrams are inaccessible for both cases.

What I propose is to replace the div tag by a link one. The href attribute points to the image, and the content of the a tag can be the alternative text, like on the following example:
Code:
<a class="pChart" href="draw.php?Seed=2" >my image legend</a>

The script would replace it by a div with the loading image at initialization (data attribute are prefixed with pchart not to hurt other library)
Code:
<div data-pchart-url="draw.php?Seed=2" data-pchart-alt="my image legend" ><!-- generated html --></div>

And it would finally load it when actually required
Code:
<div class="pChart"><img src="draw.php?Seed=2" alt="my image legend" /></div>

It would even be easy for a user to template that, for example to add a span containing the legend under the image. If the user wants to add properties to that like classes/ids, he can add a div wrapper around the original a, that will be preserved by pChart.

However that means that no html is accepted in the a tag, that could be a problem solved by saying that the alternative text is stored in a data attribute (data-pchart-alt) and that the content is just deleted.

In case you don‘t want that, would it be possible to at least replace the use of formatted id attribute by using a normal id and a data attribute? In my opinion it would more respect the semantics.

[you can delete my comment on the documentation website, I just discovered this forum that is a better place for that]

Mathieu


Thu Dec 09, 2010 5:41 pm
Profile
Site Admin
Site Admin
User avatar

Joined: Thu Dec 02, 2010 2:31 pm
Posts: 409
Location: France
Post Re: Delayed rendering request
Hi really like this idea and indeed non-js capable browser will be able to keep a link to the pictures.

I've replaced the old div syntax by :

Code:
<a class='pChart' href='draw.php?Seed=1' alt='Picture1' data-width='700' data-height='230'>Picture 1</a>


The alt, width and height tags are optional but can help to keep a reliable page layout.

Change already applied in the 2.06 and working on internet explorer & firefox.

Thank you ;o)
JD.


Fri Dec 10, 2010 9:56 am
Profile WWW
New pChart user
New pChart user

Joined: Thu Dec 09, 2010 5:27 pm
Posts: 3
Post Re: Delayed rendering request
Nice and fast! Thank you for that.

The last issue I see is that the alt attribute is not allowed in <a> tags, so pages cannot be valid html. I don't see any valid attribute that could handle that, so in my opinion it should be replaced by one data- attribute.

And I would recommend (but this is not required) to prefix data attributes like data-pchart-width (W3C recommends lowercase attributes but this is not a requirement, so data-pChart-width is acceptable too) so that if another library wants to use data attributes with the same name on this element, there will not be any conflict.


Fri Dec 10, 2010 11:45 am
Profile
Site Admin
Site Admin
User avatar

Joined: Thu Dec 02, 2010 2:31 pm
Posts: 409
Location: France
Post Re: Delayed rendering request
Again appreciated comments!

I've modified the code accordingly :

Code:
<a class=‘pChart‘ href=‘draw.php?Seed=1‘ data-pchart-alt=‘Picture1‘ data-pchart-width=‘700‘ data-pchart-height=‘230‘>Picture 1</a>


I'll release the 2.0.6 in the afternoon.


Fri Dec 10, 2010 12:19 pm
Profile WWW
Site Admin
Site Admin
User avatar

Joined: Thu Dec 02, 2010 2:31 pm
Posts: 409
Location: France
Post Re: Delayed rendering request
Here we are, 2.0.6 is out.


Fri Dec 10, 2010 5:26 pm
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 5 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron