close ad
WARNING: Do Not Install the DREAMWEAVER CC 2017 or 2018 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

displaying decimal values

Thread began 1/17/2011 11:36 am by theo373559 | Last modified 1/19/2011 4:21 pm by Jason Byrnes | 2758 views | 15 replies |

theo373559

displaying decimal values

I have created two charts using variables for the y axis that are configured in the mysql database as decimal 10,2. (They display as such in the database.) However, as you can see at: coherence_scale.php
the mean values are whole numbers. This is not good.
I have attached what I think are the relevant documents.

Sign in to reply to this post

Jason ByrnesWebAssist

the data passed into the chart will need to use the period decimal separator instead of the comma.

in design view, click the Edit XML. In the XML File, locate the </data> tag. Then add the following after it:
<numformat comma_decimal="true" />


this will display the chart using the comma separator in place of the period

Sign in to reply to this post

theo373559

Unclear about instruction

I'm afraid my comma was misleading. I was not using it to imply that the variable was coded with a comma, just that it was a decimal with two decimal places.

Here is the data tag code from the xml editor:

<data>
<dataset style="{font-size:9px;color:#767a7f;}" size="9" width="2" color="#173232" label="Scores" dotsize="5" opacity="80" abstraction="4" outline="#568176" linecolor="#568176" type="bar" subtype="fade">
<?php do { ?><point >
<label><?php echo($row_WADWCla_scores['XLABEL']); ?></label>
<value><?php echo($row_WADWCla_scores['YVALUE']); ?></value>
</point><?php } while ($row_WADWCla_scores = mysql_fetch_assoc($WADWCla_scores)); ?>
</dataset>
</data>

There is no statement about the data type that I can see. And it is not clear where it should go.

Sign in to reply to this post

Jason ByrnesWebAssist

to force the chart top show 2 decimal places;

edit the </data> tag to:

</data><numformat decimals="2" force="true" />


you can add comma_decimal="true" if you want it to use commas as the decimal separator:

</data><numformat decimals="2" force="true" comma_decimal="true" />

Sign in to reply to this post

theo373559

Tried fix, doesn't seem to make a difference

I edited the </data> tag to:

</data><numformat decimals="2" force="true" />

and uploaded the includes

but it does not correct my problem. All it does is add decimal points to the Y axis labels.

The graph still shows bars that represent whole numbers. I want the bars themselves to show the actual means.

Sign in to reply to this post

Jason ByrnesWebAssist

but all of the data points coming from the database are whole numbers. When i view source of the coherence_scale_data1.php page, I dont see any values coming from the database that have asn actuall decimal value, they are all .00


<dataset style="{font-size:9px;color:#767a7f;}" size="9" width="2" color="#173232" label="Scores" dotsize="5" opacity="80" abstraction="4" outline="#568176" linecolor="#568176" type="bar" subtype="fade">
<point >
<label>10:4</label>
<value>2.00</value>
</point><point >
<label>11:1</label>

<value>2.00</value>
</point><point >
<label>11:2</label>
<value>2.00</value>
</point><point >
<label>11:2</label>
<value>2.00</value>

</point><point >
<label>11:2</label>
<value>2.00</value>
</point><point >
<label>11:2</label>
<value>2.00</value>
</point><point >

<label>11:2</label>
<value>2.00</value>
</point><point >
<label>11:2</label>
<value>2.00</value>
</point><point >
<label>11:2</label>

<value>2.00</value>
</point><point >
<label>11:2</label>
<value>2.00</value>
</point><point >
<label>11:2</label>
<value>2.00</value>

</point><point >
<label>11:2</label>
<value>3.00</value>
</point><point >
<label>11:3</label>
<value>3.00</value>
</point><point >

<label>11:3</label>
<value>2.00</value>
</point><point >
<label>11:3</label>
<value>2.00</value>
</point><point >
<label>11:3</label>

<value>2.00</value>
</point><point >
<label>11:3</label>
<value>1.00</value>
</point><point >
<label>11:3</label>
<value>2.00</value>

</point><point >
<label>11:3</label>
<value>2.00</value>
</point><point >
<label>11:3</label>
<value>2.00</value>
</point><point >

<label>11:3</label>
<value>2.00</value>
</point><point >
<label>11:3</label>
<value>2.00</value>
</point><point >
<label>11:3</label>

<value>2.00</value>
</point><point >
<label>11:3</label>
<value>3.00</value>
</point><point >
<label>11:4</label>
<value>2.00</value>

</point><point >
<label>11:4</label>
<value>3.00</value>
</point><point >
<label>11:4</label>
<value>2.00</value>
</point><point >

<label>11:4</label>
<value>2.00</value>
</point><point >
<label>11:4</label>
<value>3.00</value>
</point><point >
<label>11:4</label>

<value>2.00</value>
</point><point >
<label>11:4</label>
<value>3.00</value>
</point><point >
<label>11:4</label>
<value>3.00</value>

</point><point >
<label>11:4</label>
<value>3.00</value>
</point><point >
<label>12:1</label>
<value>3.00</value>
</point><point >

<label>12:1</label>
<value>2.00</value>
</point><point >
<label>12:1</label>
<value>3.00</value>
</point><point >
<label>12:1</label>

<value>3.00</value>
</point><point >
<label>12:1</label>
<value>3.00</value>
</point><point >
<label>12:1</label>
<value>2.00</value>

</point><point >
<label>12:1</label>
<value>4.00</value>
</point><point >
<label>12:1</label>
<value>2.00</value>
</point><point >

<label>12:1</label>
<value>3.00</value>
</point><point >
<label>12:2</label>
<value>3.00</value>
</point><point >
<label>12:2</label>

<value>3.00</value>
</point><point >
<label>12:2</label>
<value>4.00</value>
</point><point >
<label>12:2</label>
<value>3.00</value>

</point><point >
<label>12:2</label>
<value>5.00</value>
</point> </dataset>
</data>
</wa_dwc>

Sign in to reply to this post

theo373559

Calculating averages

When average scores across a range of cases are calculated, the result is usually a decimal value. E.g., the average of 2.0 + 3.0 = 2.5. The bars represent average scores, so why do I see bars that are all at levels 1, 2, 3, 4, or 5.

Sign in to reply to this post

Jason ByrnesWebAssist

from what I can see, it does not look like the chart is set up to create an average, but I cant really answer that question without more details.

can you send a copy of ythe DynamicWebCharts/Data/coherence_scale_data1.php page, it would also help to have a dump of the database to reproduce the problem on my system to look into it further.

Sign in to reply to this post

theo373559

Additional information

That's what I suspected. I'm including the code from coherence_scale_data1.php in the text of this message, and the data table (la_scores.php) as an upload.

<?php require_once('../../Connections/Assessment.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}

$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
?>
<?php
mysql_select_db($database_Assessment, $Assessment);
$query_WADWCla_scores = "SELECT lasname_1a AS XLABEL, coherence_framing AS YVALUE FROM la_scores ORDER BY lasname_1a ASC";
$WADWCla_scores = mysql_query($query_WADWCla_scores, $Assessment) or die(mysql_error());
$row_WADWCla_scores = mysql_fetch_assoc($WADWCla_scores);
$totalRows_WADWCla_scores = mysql_num_rows($WADWCla_scores);
?>


<?php echo "<" . "?xml version=\"1.0\" encoding=\"utf-8\" ?".">"; ?><!DOCTYPE wa_dwc SYSTEM "wa_dwc.dtd">
<wa_dwc name="DTS" version="1.0">
<color_wheel name="SLATE">
<color>#173232</color>
<color>#7171</color>
<color>#70c7b1</color>
<color>#9696</color>
<color>#faeedb</color>
<color>#e0aa81</color>
</color_wheel>
<title style=" font-size:14px; color:#303431; text-align:center;">FRAMING</title>
<background color="#F4F6F2" align="left" valign="top"/>
<innerbg startcolor="#dcebe2" endcolor="#7cbaaa" direction="90"/>
<yaxis color="#568176" gridcolor="#6da496">
<labels size="11" fontcolor="#3b6e72" linecolor="#6da496">
</labels>
<legend size="12" color="#173232">Framing</legend>
</yaxis>
<xaxis color="#568176" gridcolor="#6da496" offset="true">
<legend size="12" color="#2d2b2e">Phase%20score</legend>
<labels size="11" fontcolor="#3b6e72" orientation="2" linecolor="#6da496">
</labels>
</xaxis>
<data>
<dataset style="{font-size:9px;color:#767a7f;}" size="9" width="2" color="#173232" label="Scores" dotsize="5" opacity="80" abstraction="4" outline="#568176" linecolor="#568176" type="bar" subtype="fade">
<?php do { ?><point >
<label><?php echo($row_WADWCla_scores['XLABEL']); ?></label>
<value><?php echo($row_WADWCla_scores['YVALUE']); ?></value>
</point><?php } while ($row_WADWCla_scores = mysql_fetch_assoc($WADWCla_scores)); ?>
</dataset>
</data>
</wa_dwc>
<?php
mysql_free_result($WADWCla_scores);
?>

Sign in to reply to this post

Jason ByrnesWebAssist

the recordset on this page:
SELECT lasname_1a AS XLABEL, coherence_framing AS YVALUE FROM la_scores ORDER BY lasname_1a ASC


is not set to do any averaging.


you need to set this in the chart wizard to average the la_scores columns.

Sign in to reply to this post
loading

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...