Dojox Chart: labels with html tags

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Dojox Chart: labels with html tags

Frederic Aubry
Using dojo 1.9:

For my chart, I have set the labelFunc on the plot:

chart.getPlot("default").opt.labelFunc = function (value, fixed, precision) {
  return "<div class='plot-label'>" + value.y + "</div>";
};

(BTW: there is a bug, this is the only way the labelFunc can be set)

When I inspect my document, my label was not inserted as html. It's actually quite weird:

<div&nbsp;class='plot-label'>347</div&nbsp;class='plot-label'>

Notice that white spaces have been replaced by   and the closing div is all messed up.

Is there a workaround?

Thanks for your help.

Fred
Reply | Threaded
Open this post in threaded view
|

Re: Dojox Chart: labels with html tags

Christophe Jolif-2
Hi,

Labels might or might not be HTML. They can be SVG for example. That's why returning HTML for them is not valid. However I agree there should be an easy way to style them. We really need to think about how to do this in future versions.

For your other problem I have registered it (https://bugs.dojotoolkit.org/ticket/17477) and it should be solved now. Let me know if that is not the case.



On Fri, Sep 27, 2013 at 12:44 AM, Frederic Aubry <[hidden email]> wrote:
Using dojo 1.9:

For my chart, I have set the labelFunc on the plot:

chart.getPlot("default").opt.labelFunc = function (value, fixed, precision)
{
  return "<div class='plot-label'>" + value.y + "</div>";
};

(BTW: there is a bug, this is the only way the labelFunc can be set)

When I inspect my document, my label was not inserted as html. It's actually
quite weird:

<div&nbsp;class='plot-label'>347</div&nbsp;class='plot-label'>

Notice that white spaces have been replaced by   and the closing div is
all messed up.

Is there a workaround?

Thanks for your help.

Fred




--
View this message in context: http://dojo-toolkit.33424.n3.nabble.com/Dojox-Chart-labels-with-html-tags-tp3999443.html
Sent from the Dojo Toolkit mailing list archive at Nabble.com.
________________________________________________________
Dojo Toolkit: http://dojotoolkit.org/
Tutorials: http://dojotoolkit.org/documentation/
Reference Guide: http://dojotoolkit.org/reference-guide
API Documentation: http://dojotoolkit.org/api

[hidden email]
To unsubscribe, visit: http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest



--
Christophe

________________________________________________________
Dojo Toolkit: http://dojotoolkit.org/
Tutorials: http://dojotoolkit.org/documentation/
Reference Guide: http://dojotoolkit.org/reference-guide
API Documentation: http://dojotoolkit.org/api

[hidden email]
To unsubscribe, visit: http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
Reply | Threaded
Open this post in threaded view
|

Re: Dojox Chart: labels with html tags

Frederic Aubry
Thanks Christophe.

I agree, I'd like to style these labels. If there is a voting place, I would love to add +10 on this.

As for the html aspect of the labels. I understand that labels can be html or not. This is controlled by a property. As a developer, I should know when I set this property to false that I should not return an html string. However, if the property is true, I could return an html string...
 


Reply | Threaded
Open this post in threaded view
|

Re: Dojox Chart: labels with html tags

Christophe Jolif-2
Waiting for this to be implemented you can look at renderLabel method on plot2d/Base.js and override it to do whatever you need to do.


On Fri, Sep 27, 2013 at 5:37 PM, Frederic Aubry <[hidden email]> wrote:
Thanks Christophe.

I agree, I'd like to style these labels. If there is a voting place, I would
love to add +10 on this.

As for the html aspect of the labels. I understand that labels can be html
or not. This is controlled by a property. As a developer, I should know when
I set this property to false that I should not return an html string.
However, if the property is true, I could return an html string...







--
View this message in context: http://dojo-toolkit.33424.n3.nabble.com/Dojox-Chart-labels-with-html-tags-tp3999443p3999458.html
Sent from the Dojo Toolkit mailing list archive at Nabble.com.
________________________________________________________
Dojo Toolkit: http://dojotoolkit.org/
Tutorials: http://dojotoolkit.org/documentation/
Reference Guide: http://dojotoolkit.org/reference-guide
API Documentation: http://dojotoolkit.org/api

[hidden email]
To unsubscribe, visit: http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest



--
Christophe

________________________________________________________
Dojo Toolkit: http://dojotoolkit.org/
Tutorials: http://dojotoolkit.org/documentation/
Reference Guide: http://dojotoolkit.org/reference-guide
API Documentation: http://dojotoolkit.org/api

[hidden email]
To unsubscribe, visit: http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
Reply | Threaded
Open this post in threaded view
|

Re: Dojox Chart: labels with html tags

Rekha S S
This post has NOT been accepted by the mailing list yet.
Major tick step is 1.1.But it is displaing more dicimal points on y  axis like 3.3000000000000003 instead of displaying  only 3.3.please find the attchment  .Can u please let me know how to avoid from displaying large number on the screen.
*************************************************************************************************************************
var chart = new dojox.charting.Chart('topResConsId',{  margins: {l: 0,r: 0, t: 0, b: 0}});

chart.addAxis('x', {includeZero:true,leftBottom:true,vertical:false,fixUpper:'none',fixLower:'none',majorTickStep:1.00,majorLabels:true,
labels: [{value:1.0,text:"astroslp01"},{value:2.0,text:"Test_AIX"}]});
       
chart.addAxis('y', {includeZero:true,leftBottom:true,vertical:true,min:0.0, max:5.5,fixUpper:'none',
fixLower:'none',majorTickStep:1.1,majorLabels:true,fixed: false});
               
chart.addPlot('topResConsPlot', {type: 'Candlesticks',gap:2,minBarSize:2, maxBarSize:5,hAxis: 'x',vAxis: 'y'});
               
chart.addSeries('TopResConsumer',[{low:5.50,open:5.50,close:5.50,high:5.50},                         {low:3.22,open:3.22,close:3.22,high:3.22}],{plot: 'topResConsPlot',stroke: {color:'#86B347',style:'none', width:2}});

chart.render();

*************************************************************************************************************************

Please find the attachment for the chart snapshot.
 Multiple decimal points on y axis
Reply | Threaded
Open this post in threaded view
|

Re: Dojox Chart: labels with html tags

Rekha S S
This post has NOT been accepted by the mailing list yet.
contiuation of previous pcontuing with previous reply

If we remove "fixed" attribute  from  y -axis like below
chart.addAxis('y', {includeZero:true,leftBottom:true,vertical:true,min:0.0, max:5.5,fixUpper:'none',
                fixLower:'none',majorTickStep:1.1,majorLabels:true});



Graph looks like below



But This graph also having some issue like below

1.acutaul major tick step is 1.1.So y-axis label should  be 1.1,2.2,3.3,4.4,5.5

but as per the graph snapshot ,it is displaying 1,2,3,4,6

which is wrong and also 5 is missing .
and max is 5.5 but displaying 5.

So i am totally confused abt this issue.I want  to have 1.1,2.2,3.3,4.4,5.5 as  y-axis label.

Can u pleas let me know how to solve this issue