How to create a trend line in cfchart?
I can create a scatter chart in cfchart - but I do not know how to create a linear regression trend line in the same chart as a second data series.
Kodemonki provided an answer in a forum discussion a few years ago (http://forums.adobe.com/message/192848#192848).
But I am not able to make it work (I have a dangerously small knowledge of coldfusion and statisitcal formulas).
Can someone tell me where i put in my to data query variables - such as for a query that gives results for two data fields, "Item1" and "Item2".
Thanks!
Here is Kodemonki's solution:
<!--- The min setting is a preference based on how you want the data to be displayed. --->
<!---<cfset min = arrayMin(grabData["value"]) - 5>--->
<cfset min = 0>
<cfset max = ceiling(arrayMax(grabData["value"])) + 1>
<cfset n = grabData.recordCount>
<cfset sum_x = 0>
<cfset sum_x2 = 0>
<cfset sum_xy = 0>
<cfloop from="1" to="#grabData.RecordCount#" index="i">
<cfset sum_x = sum_x + i>
<cfset sum_xy = (i*grabData.value[i]) + sum_xy>
<cfset sum_x2 = sum_x2 + (i*i)>
</cfloop>
<cfset sum_y = arraySum(grabData["value"])>
<cfset slope = round(((n*sum_xy) - (sum_x*sum_y))/((n*sum_x2) - (sum_x*sum_x)))>
<cfset intercept = round((sum_y - (slope*sum_x))/n)>
<cfset best_fit = QueryNew("id, value")>
<cfloop from="1" to="#grabdata.RecordCount#" index="i">
<cfset queryAddRow(best_fit)>
<cfset value = round((slope*i) + intercept)>
<cfset QuerySetCell(best_fit, "id", grabData.xlabel[i])>
<cfset QuerySetCell(best_fit, "value", value)>
</cfloop>
<cfchart scalefrom="#min#" scaleto="#max#" title="#GrabDatapointInfo.label#" format="jpg" chartHeight="450" chartwidth="500" xaxistitle="Month/Year">
<cfchartseries type="line" query="best_fit" valuecolumn="value" itemcolumn="id"/>
<cfchartseries type="line" query="grabData" valuecolumn="value" itemcolumn="xlabel"/>
</cfchart>
Have you read the docs for CFCHART, CHCHARTSERIES, etc? Did you mess around with the example code sufficiently so you understand how the tags work?
http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec22c24-79 30.html
Adam
Similar Messages
-
Can You Create Trend Line in CFCHART?
Have pretty much got CF7 Charts and WebCharts3D down, at
least to the point where they can do what I need the most. However,
the one thing I'd like to be able to do, but not sure if it's
possible, is create a TREND LINE.
This would be a LINE charts with 2 series. The first series
would be a line with the actual counts covering a period of time.
I'd like to add a 2nd line, using the same data from the
first series, but have it displayed as a TREND line. In Excel, you
can easily create a TREND line, it's even offered as an option.
I've seen somehwere (CFCHART or WebCharts3D) something to so
with "logarithmic" options, which is one of the options for Excel
charts.
Two more quick questions:
Q1. Is there any way to control the margin between the left
and right borders of the charts, and the bars? Have tried
experimenting, but can't seem to get this to work. Reason is, when
I try to show a chart in 3D, the first bar on the left is "butted
up" against the left chart border. Would like to add a little space
there.
Q2. Rather than display rectangular bars, I'd like to display
rounded cylinders. I've tried setting the chart type in CFCHART to
"cylinder" but it still displays a bar. When I try to change the
type to "cylinder" in WebCharts3D, the chart STILL displays
rectangular bars. Yet I've seen many examples of rounded, cylinder
bars.
Don't mean to push my luck with too many questions. Thanks
for any advice, help.
GaryTrend Lines:
CFChart does not do trend lines of any type. However, it is
not too difficult to compute the regression of your choice and to
plot it as a second series.
Logarithmic:
Not sure what you are asking here.
In theory, cfchart does do log-lin and log-log charts.
However, it is so buggy, and the scaling problems are so
great, that we have never been able to get it to work well.
We use ChartDirector for anything that requires a log scale.
Side margins:
You cannot control these directly. Here are some workarounds:
For "Category" axis:
Make sure the "isBucketed" property is set to true (this is the
default).
If that is not enough, add extra bars to your data series,
usually value zero. It's not ideal but it may be good enough.
For "Scale" axis:
Usually this works well enough. Otherwise, try toggling the
"isAbsolute" property.
The only other recourse is to manually scale the plot using the
"scaleMin" and "scaleMax" properties. This can be a real pain for
obvious reasons and also because cfchart scaling is fraught with
bugs and "quirks".
Cylinder Bars:
These work. Perhaps there was a setting conflict within the
XML or between the CFChartSeries setting and the XML?
Also the cylinders will only look round when 3D is turned on.
(Side view of a cylinder is just a shaded bar.)
Anyway, I've said it before: cfchart is barely usable for a
very limited range of charts.
For real business or common engineering and scientific needs,
you need to step up to something better.
The package we use (has all the features and very reasonably
priced) is ChartDirector (
http://www.advsofteng.com/cdcoldfusion.html).
(And, no, I'm not affiliated.) -
How to create a muli line text area using JavaFx
Hi all,
Since the preview SDK does not contain TextArea any more, I am wondering how to create a muli line text area using JavaFX. The behaviour of this text area/field should be somehow similar to JTextArea in Swing or StyledTextWidget in SWT.
Does JavaFX have any support for this? What would be a sensible approach to create such a widget?
Thanks for your suggestions,
br michaelThis is a pretty old thread (I know I came across this while searching for something similar recently), but I figured I'd throw this out there in case other people might find this useful. As I write this, JavaFX's latest version is 1.3... which may have added the needed functionality since the last post.
You can now create a multi-line text area using a TextBox and by specifying the nubmer of lines and setting the "multiline" value to true. It may not offer all of the same functionality as JTextArea, but it did the job for what I needed... newlines by pressing enter, scrollbar if text surpasses height, etc.
Here's a simple example:
Group {
content: [
TextBox {
text: "This is a multi-line textbox"
lines: 10 // <-- this may/may not be necessary depending on your situation. Default is 5.
multiline: true
}Edited by: loeschg on Jul 29, 2010 2:59 PM -
How to create a new line in label in Xcode
How to create a new line in label. for example I have two buttons & one label. when i press first button, l want to change the label text to "Hello World". then when I press the second button, on the same label I need to display"Good Bye" on the next line in xcode 5?
I want to display the lablel like below:
Hello World
Good ByeI am using Xcode to develop an app for iOS.
I tried using multi-line label & belwo is my code.
- (IBAction)change:(UIButton *)sender {
self.Screen.text = @"\nHello World";
- (IBAction)newChange:(UIButton *)sender {
self.Screen.text = @"\nGood bye";
everytime when i pressed the button, it replacing the whold lable text instead of adding the second line. -
How to create a multi-line table/column comment
Can someone tell me how to create a multi-line table or column comment?
Apparently, the concatenate operator (||) does not work with the COMMENT statement.
I've searched the Oracle manuals and couldn't find an answer.
COMMENT ON TABLE sometbl IS 'i would like to break up this comment into several lines in order to improve readability'; Effectively, this is what I'd like to do (but it doesn't work):
COMMENT ON TABLE sometbl IS
'i would like to break up ' || CHAR(10) ||
'this comment into several lines ' || CHAR(10) ||
'in order to improve readability' || CHAR(10); Oracle version is 10.2.0.4Why not just
SQL> create table t (a int)
Createtable successfully completed.
SQL> comment on table t is 'i would like to break up
this comment into several lines
in order to improve readability'
Commenton successfully completed.
SQL> select * from user_tab_comments where table_name = 'T'
TABLE_NAME TABLE_TYPE COMMENTS
T TABLE i would like to break up
this comment into several lines
in order to improve readability
1 row selected.? -
How to create curve fitted line chart?
Line chart is formed with straight lines, but how to create curve fitted line chart?
Jasper wrote a blog on curve fitting charts
-
Is it possible to create a trend line in HTML DB 2.0?
Hello again!
I am trying to replicate bar charts that were created in EXCEL that took advantage of the Trend Line feature. I can create the bar chart just fine, but I am not able to create the trend line. Is there a way to do this? Thanks in advance for your help.You could sort-of simulate a trend line by adding a second series of bars that plots the trend data.
For example, the first series could plot your data, and the second series could plot the running average.
Analytic functions are handy for this. -
HELP! PDF objects - How to create a program line object?
Hi Experts,
I would like to know how to create a Program lines object (icon cog wheels). I need to create additional coding inside the context tab but when I try to right click on a folder --> create -->graphic,address,text,alternative...single record... No
program lines can be created.
Hope someone could help me.
Thanks,
JeffThere are two ways of doing it, depending on what you want to accomplish. Both require that you edit the file ~/.bashrc (I assume you use bash)
1) If the application places all the executable files in a given directory (let's say /opt/Application/bin/), you can access all those executables directly by simply telling your shell where to look (in the same way the shell automatically looks for executable files in eg. /usr/bin). In ~/.bashrc, you would have to add a line that looks like this:
PATH="$PATH:/opt/Application/bin"
2) If you just want to make a traditional "shortcut" that executes a given command, this can be done with alias. Add this command to your ~/.bashrc:
alias shortcut="some command"
In this case, typing shortcut into a terminal will be interpreted just like if you had typed some command instead.
In order to try out these changes, either restart your terminal or run this command:
source ~/.bashrc
[EDIT]
I was obviously beaten to it
Last edited by Peanut (2009-05-26 23:12:47) -
How to create a stroked line that randomize each stroke color?
Hi all, I am strating out designing in illustrator and I need help on how to created a stroked line, -----------, with each stroke ( - ) a different colour, like, each stroke having a different randomized color which differs from the next one.
Also, I need help on how to mask out parts of a template given to me by my school so i dont infringe that boundary when I add my lines to it. All helps appreciated, thank you.Ok thank you for your responses, Monika, I followed your instruction but it isnt working, is there any steps that I might have done wrongly? Here are some screenshots that depicts my problem:
Here it is after I outline the stroke,
And here it is when I apply the script:
However, after I clicked okay, nothing changed and the strokes are still in their original color(yellow) as seen in the first picture. Did I do any steps wrong that result in this outcome? Also I've tried to put 99 instead of 99s and still, it didnt work. -
How to create a multiple-line TextBox in a jfx script?
How to create a multiple-line TextBox in a jfx script?
Or
How to use the Swing component JTextArea in a jfx script?
Please post a brief code segment.
Thanks,
AsgharThis supports two way binding between JavaFX and Java and also cut and paste.
Enjoy.
* MyTextArea.fx
* Created on Dec 14, 2008, 7:23:49 AM
package twifxer.components;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.awt.Font;
import javafx.ext.swing.SwingComponent;
import javax.swing.JComponent;
import javax.swing.JTextArea;
import java.awt.Color;
* @author Steven Herod
public class TweetTextComponent extends SwingComponent{
var myComponent: JTextArea;
public var length: Integer;
public var readText:String;
public var text: String on replace{
myComponent.setText(text);
public var toolTipText: String on replace{
myComponent.setToolTipText(toolTipText);
public override function createJComponent():JComponent{
translateX = 15;
translateY = 5;
var f:Font = new Font("sanserif",Font.PLAIN, 11);
myComponent = new JTextArea(4, 33);
myComponent.setOpaque(false);
myComponent.setFont(f);
myComponent.setWrapStyleWord(true);
myComponent.setLineWrap(true);
myComponent.addKeyListener( KeyListener{
public override function
keyPressed(keyEvent:KeyEvent) {
if (keyEvent.VK_PASTE == keyEvent.getKeyCode())
myComponent.paste();
public override function
keyReleased( keyEvent:KeyEvent) {
var pos = myComponent.getCaretPosition();
text = myComponent.getText();
myComponent.setCaretPosition(pos);
public override function
keyTyped(keyEvent:KeyEvent) {
length = myComponent.getDocument().getLength();
return myComponent;
} -
How to create trend line in cfchart?
I can create a scatter chart in cfchart - but I do not know how to create a linear regression trend line in the same chart as a second data series. Kodemonki provided an answer in a forum discussion a few years ago (http://forums.adobe.com/message/192848#192848) - but I am not able to make it work (I have a dangerously small knowledge of coldfusion and statisitcal formulas). Can someone tell me where i put in my to data query variables - such as for a query that gives results for two data fields, "Item1" and "Item2".
Here is Kodemonki's solution:
<!--- The min setting is a preference based on how you want the data to be displayed. --->
<!---<cfset min = arrayMin(grabData["value"]) - 5>--->
<cfset min = 0>
<cfset max = ceiling(arrayMax(grabData["value"])) + 1>
<cfset n = grabData.recordCount>
<cfset sum_x = 0>
<cfset sum_x2 = 0>
<cfset sum_xy = 0>
<cfloop from="1" to="#grabData.RecordCount#" index="i">
<cfset sum_x = sum_x + i>
<cfset sum_xy = (i*grabData.value[i]) + sum_xy>
<cfset sum_x2 = sum_x2 + (i*i)>
</cfloop>
<cfset sum_y = arraySum(grabData["value"])>
<cfset slope = round(((n*sum_xy) - (sum_x*sum_y))/((n*sum_x2) - (sum_x*sum_x)))>
<cfset intercept = round((sum_y - (slope*sum_x))/n)>
<cfset best_fit = QueryNew("id, value")>
<cfloop from="1" to="#grabdata.RecordCount#" index="i">
<cfset queryAddRow(best_fit)>
<cfset value = round((slope*i) + intercept)>
<cfset QuerySetCell(best_fit, "id", grabData.xlabel[i])>
<cfset QuerySetCell(best_fit, "value", value)>
</cfloop>
<cfchart scalefrom="#min#" scaleto="#max#" title="#GrabDatapointInfo.label#" format="jpg" chartHeight="450" chartwidth="500" xaxistitle="Month/Year">
<cfchartseries type="line" query="best_fit" valuecolumn="value" itemcolumn="id"/>
<cfchartseries type="line" query="grabData" valuecolumn="value" itemcolumn="xlabel"/>
</cfchart>Have you read the docs for CFCHART, CHCHARTSERIES, etc? Did you mess around with the example code sufficiently so you understand how the tags work?
http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec22c24-79 30.html
Adam -
How to create a new line item automatically in CRMD_ORDER
Hi,
While creating a sales order in CRMD_ORDER, after user enters a line item say 'xxxx' and press 'Enter', we need to create a new line item say 'yyyy' dynamically. Any ways of how to achieve this functionality?
thanks in advance,
amar.sHi Amar
You can use structured products:
Step1:COMM_PR01
Open Product xxxx > Relationships > Tab Component > Select Relationship type = STRSET Set > Assing product yyyy
Step2: IMG > CRM > Transactions > Define Item Categories
Open you item category and in Structure scope field select option A Single-Level Explosion of structured products
Step3: IMG > CRM > Transactions > Define Item Category Determination
create new entry
Transaction type =
Item category group = Category group of xxxx product
main item cat = item cat of xxxx product
item cat = item cat of yyyy product
now when you enter product xxxx , product yyyy will be automatically added
Hope it helps
Rupesh -
How to create a wavy line with the Pen Tool?
Let me start by saying that I am a novice to Adobe CS4, including PS.
I am trying to follow this tutorial: http://www.rnel.net/tutorial/Photoshop/11541 but I can not even get the pen to draw wavvy line. I keep get a straight line. To say the least, I am only able to complete creating the file.
How do I create a wavvy line or lines using the Pen Tool?Check out this page from the Help Files:
Draw curves with the Pen tool:
http://help.adobe.com/en_US/Photoshop/11.0/WS08E4D386-15E9-4dcd-91E6-DF4219CC6D24.html -
How to create a "Command Line"/"Text Validation"
I want to create a command line like the picture. I'm using "Input Text" method for text. Variable name is "myText", Instance Name is "line".
How can I use "if" in input text like this:
Command name is: exit, if user wrote "exit" command, exit the flash app.This is a pretty old thread (I know I came across this while searching for something similar recently), but I figured I'd throw this out there in case other people might find this useful. As I write this, JavaFX's latest version is 1.3... which may have added the needed functionality since the last post.
You can now create a multi-line text area using a TextBox and by specifying the nubmer of lines and setting the "multiline" value to true. It may not offer all of the same functionality as JTextArea, but it did the job for what I needed... newlines by pressing enter, scrollbar if text surpasses height, etc.
Here's a simple example:
Group {
content: [
TextBox {
text: "This is a multi-line textbox"
lines: 10 // <-- this may/may not be necessary depending on your situation. Default is 5.
multiline: true
}Edited by: loeschg on Jul 29, 2010 2:59 PM -
How to create diagonal variable line pattern in CS6?
Hi guys
I'm on the brink of insanity with creating my diagonal line pattern. I've tried everything I can think of but the pattern is an absolute mess! I want to create a diagonal line pattern but I want the lines not to be uniform. Basically I've made a group of 3 lines and then one separate line on its own, then to repeat this as the picture below. I've used the distribute function so the distances between the lines is identical everywhere. I've then rotated the whole thing exactly 45 degrees and aligned the lines to fit the bounding box in the "make pattern" mode as shown. Yet the resulting pattern is just a mess of overlap ugliness. All I want is for the pattern to literally look as it does in the image on the left, can someone please tell me how to sucessfully do this in CS6?? Would be eternally grateful!!
Desired pattern: Result:Never create a line pattern at an angle. It's unnecessary.
Create the pattern at 90° angles then use Object > Transform > Rotate and tick the "Transform Patterns" option and enter the angle you are after....
Trying to get angled lines to match in a pattern can take considerable effort. Where as with this method you can create the pattern and rotate it in a matter of minutes. Let Illustrator work for you rather than against you. And, you can rotate to any angle so the pattern will function in multiple ways.
Maybe you are looking for
-
I am on a Mac Pro, OS X 10.9.5, 16 GB RAM I have been a fanatical Adobe devotee since 1989, but now I am beginning to see the value in other software packages. All Adobe design programs (AI, PSD, ID) work, except CC app and Adobe Application Manager.
-
Suggestion on Intra and inter company process
Hi I have a requirement where we are configuring both intra and inter company billing thorugh one sales doucment type. Intra :Process: ORder ---> PR/PO ---> MIGO--> MIRO ---> Delivery. ( Between same company codes) Inter Process Order ---> PR/PO ---
-
Jtable's tablecell editing problem
there are some jcomponets in a jframe(jtable, jtextfield, jbutton, eg.), i edit in a tablecell in the jtable first, then i click another tablecell , when the first tablecell's value i just edited has committed; but when i click on jtextfield (another
-
Retrieve Catalog details after the processing of SC
Hi Experts, Scenario: After selecting a product from the catalog, the shopping cart is waiting for approval or is with the operational purchaser. At that point if the price in the catalog for the product changes then it should be be retrieved from th
-
Itunes could not synced with my iphone
I don't know what's happened, the itunes gave the following error message : " itunes COULD NOT SYNC CONTACTS(CALENDAR) TO IPHONE BECAUSE THE SYNC SERVER FAILED TO SYNC TO PHONE" i cant sync my iphone with my outlook 2007 cause of that. thanks.