[Dojo-interest] SVG chart resizing

80 views
Skip to first unread message

E A

unread,
Feb 27, 2012, 11:33:53 PM2/27/12
to dojo-i...@mail.dojotoolkit.org
Hi there,

I have a bar graph in a DIV with a specific x and y but the graph renders mostly outside of its container div because it is larger. How do I get the graph to resize to the same of its container div?

Thanks

Bindhu John

unread,
Feb 28, 2012, 2:55:40 AM2/28/12
to dojo-i...@mail.dojotoolkit.org
Hi,
 
I am trying to render a Dojo chart plugin in our web app. Initially I was having some path issues for the javascript. Marian helped to resolve it. Now when I tried to view the web page, it just shows blank page bot in IE and Firefox and there are no errors using develoer tools or firebug.
 
I am trying the basic example shown in the documentation.Could you please help. I have pasted the code below for your perusal.
 
 /// Created using the page template: Default
Class ISS.dojochart Extends %ZEN.Component.page
{

/// Class name of application this page belongs to.
Parameter APPLICATION;

/// Displayed name of this page.
Parameter PAGENAME = "Dojo Chart";

/// Domain used for localization.
Parameter DOMAIN = "www.intersystems.com/zen";

/// This Style block contains page-specific CSS style definitions.
XData Style
{
<style type="text/css">
</style>
}

/// This XML block defines the contents of this page.
XData Contents [ XMLNamespace = "http://www.intersystems.com/zen]
{
<page xmlns="http://www.intersystems.com/zentitle="">
<html>
    <body>

   <!-- create the chart -->
<div dojoType="dojox.charting.widget.Chart2D" theme="dojox.charting.themes.Claro" id="viewsChart" style="width: 550px; height: 550px;">

<!-- Pie Chart: add the plot -->
<div class="plot" name="default" type="Pie" radius="200" fontColor="#000" labelOffset="-20"></div>

<!-- pieData is the data source -->
<div class="series" name="Last Week's Visits" array="chartData"></div>

</div>



</body>
</html>
</page>
}

/// This callback is called at the end of the HTML HEAD section of the page.<br/>
/// (default implementation is a simple expression).
Method %OnDrawHTMLHead() As %Status
{
                
 &html<
    <meta charset="utf-8">
    <title>Tutorial: Hello Dojo!</title>

<link rel="stylesheet" href="style.css" media="screen">
<link rel="stylesheet" href="demo.css" media="screen">
<!-- load dojo and provide config via data attribute -->
<script>
djConfig = {
isDebug: true,
parseOnLoad: true
};
</script>

<script src="dojo/dojo.js"></script>
<script>

// Grab the parser
dojo.require("dojo.parser");

// Require the basic 2d chart resource: Chart2D
dojo.require("dojox.charting.widget.Chart2D");

// Require the theme of our choosing
//"Claro", new in Dojo 1.6, will be used
dojo.require("dojox.charting.themes.Claro");

// x and y coordinates used for easy understanding of where they should display
// Data represents website visits over a week period
chartData = [
{ x: "1", y: "19021" },
{ x: "1", y: "12837" },
{ x: "1", y: "12378" },
{ x: "1", y: "21882" },
{ x: "1", y: "17654" },
{ x: "1", y: "15833" },
{ x: "1", y: "16122" }
];

</script>

>
quit $$$OK
}

}

Dylan Schiemann

unread,
Feb 28, 2012, 10:03:38 AM2/28/12
to dojo-i...@mail.dojotoolkit.org
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I believe you said you were using 1.7, but you're copying an example
with 1.6 syntax. While that should work, why don't you try simply
copying the appropriate sections from the 1.7 documentation and going
from there e.g.:

http://dojotoolkit.org/documentation/tutorials/1.7/charting/demo/basic-declarative.html
(from http://dojotoolkit.org/documentation/tutorials/1.7/charting/ )

Or, if it helps, here's a JSFiddle with the same source that shows a
chart working: http://jsfiddle.net/dylan/XYrYT/

Yes, the DataChart and DataSeries are nice, but if your goal is to show
a chart in a page, start with the simplest example from the simplest
tutorial and work your way up from there.

Regards,
- -Dylan

on 2/28/12 12:55 AM (GMT-07:00) Bindhu John said the following:

> ________________________________________________________
> Dojotoolkit: http://dojotoolkit.org
> Reference Guide: http://dojotoolkit.org/reference-guide
> API Documentation: http://dojotoolkit.org/api
> Tutorials: http://dojotoolkit.org/documentation
>
> Dojo-i...@mail.dojotoolkit.org
> http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk9M7MoACgkQ1E2HcBNypM7qZACeMNAM4f5Z0cBr9FPPQ5OMcDD2
f2gAnjVwUMns7QNEVtGfZctTRc3eveRv
=QGqc
-----END PGP SIGNATURE-----
________________________________________________________
Dojotoolkit: http://dojotoolkit.org
Reference Guide: http://dojotoolkit.org/reference-guide
API Documentation: http://dojotoolkit.org/api
Tutorials: http://dojotoolkit.org/documentation

Dojo-i...@mail.dojotoolkit.org
http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest

Bindhu John

unread,
Feb 28, 2012, 11:13:57 AM2/28/12
to dojo-i...@mail.dojotoolkit.org
Hi Dylan,
 
Thanks for your reply. I was initially follwoing these examples below. Then I got some messages in regards to being deprecated. I thought then, I will start with a simple example and go from there.
 
May I check, the code below, I have listed, if it have to work with 1.7, do I have to add anything extra. Please let me know. I shall try the link today.
 
Thanks
 
Bindhu

Dylan Schiemann

unread,
Feb 28, 2012, 11:41:18 AM2/28/12
to dojo-i...@mail.dojotoolkit.org
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Start with the example I provided, it works.

Regards,
- -Dylan

on 2/28/12 9:13 AM (GMT-07:00) Bindhu John said the following:


> Hi Dylan,
>
> Thanks for your reply. I was initially follwoing these examples below.
> Then I got some messages in regards to being deprecated. I thought then,
> I will start with a simple example and go from there.
>
> May I check, the code below, I have listed, if it have to work with 1.7,
> do I have to add anything extra. Please let me know. I shall try the
> link today.
>
> Thanks
>
> Bindhu
>

> *From:* Dylan Schiemann <dy...@dojotoolkit.org>
> *To:* dojo-i...@mail.dojotoolkit.org
> *Sent:* Tuesday, February 28, 2012 10:03 AM
> *Subject:* Re: [Dojo-interest] Graph not at all displaying


>
> I believe you said you were using 1.7, but you're copying an example
> with 1.6 syntax. While that should work, why don't you try simply
> copying the appropriate sections from the 1.7 documentation and going
> from there e.g.:
>
> http://dojotoolkit.org/documentation/tutorials/1.7/charting/demo/basic-declarative.html
> (from http://dojotoolkit.org/documentation/tutorials/1.7/charting/ )
>
> Or, if it helps, here's a JSFiddle with the same source that shows a
> chart working: http://jsfiddle.net/dylan/XYrYT/
>
> Yes, the DataChart and DataSeries are nice, but if your goal is to show
> a chart in a page, start with the simplest example from the simplest
> tutorial and work your way up from there.
>
> Regards,

> -Dylan
>
> on 2/28/12 12:55 AM (GMT-07:00) Bindhu John said the following:
>> Hi,
>
>> I am trying to render a Dojo chart plugin in our web app. Initially I
>> was having some path issues for the javascript. Marian helped to resolve
>> it. Now when I tried to view the web page, it just shows blank page bot
>> in IE and Firefox and there are no errors using develoer tools or firebug.
>
>> I am trying the basic example shown in the documentation.Could you
>> please help. I have pasted the code below for your perusal.
>
>> /// Created using the page template: Default
>> Class ISS.dojochart Extends %ZEN.Component.page
>> {
>
>> /// Class name of application this page belongs to.
>> Parameter APPLICATION;
>
>> /// Displayed name of this page.
>> Parameter PAGENAME = "Dojo Chart";
>
>> /// Domain used for localization.
>> Parameter DOMAIN = "www.intersystems.com/zen

> <http://www.intersystems.com/zen>";

> <mailto:Dojo-i...@mail.dojotoolkit.org>
>> http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
> ________________________________________________________
> Dojotoolkit: http://dojotoolkit.org <http://dojotoolkit.org/>

> <mailto:Dojo-i...@mail.dojotoolkit.org>
> http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest


>
>
> ________________________________________________________
> Dojotoolkit: http://dojotoolkit.org
> Reference Guide: http://dojotoolkit.org/reference-guide
> API Documentation: http://dojotoolkit.org/api
> Tutorials: http://dojotoolkit.org/documentation
>
> Dojo-i...@mail.dojotoolkit.org
> http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk9NA64ACgkQ1E2HcBNypM5uXQCdGaIXhEa0VzGAVdzDv8yCU5Vt
ppQAn3nN84r21sFpEw1lYyT5c/BOBj0M
=2MkJ

Eugene Lazutkin

unread,
Feb 29, 2012, 12:14:56 AM2/29/12
to dojo-i...@dojotoolkit.org
Just specify width/height in pixels when you create a chart.

Cheers,

Eugene Lazutkin
Dojo Toolkit, Committer
http://lazutkin.com/

Reply all
Reply to author
Forward
0 new messages