 |
AutoHotkey Community Wir helfen uns gegenseitig aus der Patsche
|
| Vorheriges Thema anzeigen :: Nächstes Thema anzeigen |
| Autor |
Nachricht |
fredchf
Anmeldedatum: 18.09.2006 Beiträge: 665 Wohnort: Deutschland
|
Verfasst am: Mi Apr 30, 2008 4:34 pm Titel: Diagramme vereinfacht mit ahk darstellen? |
|
|
hallo!
ich suche eine elegante möglichkeit diagramme,möglichst ohne weitere software, darzustellen.
eine möglichkeit die mir spontan einfiel,ist die diagramme als text darzustellen(siehe foto).noch nicht wirklich überzeugend! gibt es vielleicht eine möglichkeit der grafischen darstellung?
hat vielleicht jemand anderes sich dem thema auch schon mal gewidmet,oder eine gute idee wie man das besser darstellen könnte?danke schon einmal für eure anregungen...
| Code: | zz =
(
1300|QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ
----|QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ
----|QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ
----|QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ
1200|QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ
----|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QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ
----|QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ
----|QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ
100-|QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ
----|QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ
----|QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ
----|_QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ
0______________30_____________60_____________90_____________120____________150____________180____________210____________240__
)
gui, font, s3, Verdana
gui, add, text, , %zz%
gui, show
Return
esc::
GuiClose:
ExitApp
|
 _________________ Mit freundlichen Grüßen
fredchf |
|
| Nach oben |
|
 |
Chucky
Anmeldedatum: 07.01.2006 Beiträge: 616 Wohnort: Powerland
|
Verfasst am: Mi Apr 30, 2008 9:11 pm Titel: Re: Diagramme vereinfacht mit ahk darstellen? |
|
|
Hi fredchf!
Hier ist ein ganz interessantes Script, das Funktionsgraphen darstellt. Es läßt sich bestimmt auch dazu bringen, Datenpunkte anzuzeigen. |
|
| Nach oben |
|
 |
fredchf
Anmeldedatum: 18.09.2006 Beiträge: 665 Wohnort: Deutschland
|
Verfasst am: Do Mai 01, 2008 5:43 am Titel: |
|
|
moin chucky,
vielen dank,das dürfte genau meine bedürfnisse treffen!
jetzt muss ich aber erstmal schlafen(nachtschicht) _________________ Mit freundlichen Grüßen
fredchf |
|
| Nach oben |
|
 |
denick (n-l-i) Gast
|
Verfasst am: Mi Mai 07, 2008 3:30 pm Titel: |
|
|
Moin fredchf,
wenn Du Chucky's Anregung umgesetzt hast, verfügst Du über die Luxusvariante.
Ich habe mich ausgehend von Deiner oben gezeigten Gui auch mal mit dem Thema beschäftigt. Hast Du noch Interesse an einer simpleren Variante?
Gruß,
(de)nick |
|
| Nach oben |
|
 |
fredchf
Anmeldedatum: 18.09.2006 Beiträge: 665 Wohnort: Deutschland
|
Verfasst am: Mi Mai 07, 2008 9:25 pm Titel: |
|
|
hallo denick,
vielen dank erstmal für dein interesse,den tip von chucky konnte ich leider nur teiweise umsetzen und habe deshalb heute per pm kontakt zu ihm aufgenommen! mir ist es zwar gelungen aus meinen koordinaten(messreihen) diagramme zu erstellen,aber mit einigen problemen:
* die kurve beginnt noch immer oben links statt unten links
* und statt einen maßstab über die optionen xScl (1) bzw. yScl (1) ,passe ich im moment noch die quelldaten an
aufruf mit typischer messreihe:
| Code: | #include grapher.ahk
DetectHiddenWindows On
OnExit GuiClose
Gui Add,Progress,w402 h1 x10 y10
Gui Add,Progress,w1 h402 x10 y10
Gui Add,Progress,w402 h1 x10 y411
Gui Add,Progress,w1 h402 x411 y10
Process Exist
WinGet ScriptID,ID,ahk_pid %ErrorLevel%
Gui Show,w722 h722,Function Grapher
GraphOpt_defGraphColor := 0xFF0000 ;red
GraphCreate(ScriptID,10,10,700,700,"GraphOpt_")
Gosub, zu_testzwecken
Loop, Parse, messreihe, `n
{
StringSplit, Array, A_LoopField, `;
RegExMatch(Array2, "\d+", y)
x%A_Index% := Array1 * 3 ;statt die skalierung zu ändern,habe ich einfach x- u. y-koordinaten angepasst
y%A_Index% := y / 2
wie = %A_Index%
}
GraphLine("x","y",wie)
return
GuiContextMenu:
InputBox,Equation,Function Grapher,Enter an equation in terms of x:
Graph(Equation)
return
GuiEscape:
GraphClear()
return
esc::
GuiClose:
GraphDestroy()
ExitApp
; ######################################
; hier kommt nur noch meine messreihe
; typische messreihe
; #####################################
zu_testzwecken:
messreihe =
(
0;0
1;113,2813
2;177,7344
3;178,7109
4;180,6641
5;179,6875
6;181,6406
7;181,6406
8;183,5938
9;185,5469
10;186,5234
11;187,5
12;189,4531
13;191,4063
14;195,3125
15;199,2188
16;202,1484
17;206,0547
18;208,0078
19;208,9844
20;210,9375
21;213,8672
22;215,8203
23;216,7969
24;219,7265
25;222,6563
26;227,5391
27;230,4688
28;234,375
29;239,2578
30;244,1406
31;247,0703
32;250
33;252,9297
34;254,8828
35;259,7656
36;262,6953
37;264,6484
38;270,5078
39;271,4844
40;273,4375
41;274,4141
42;279,2969
43;283,2031
44;286,1328
45;288,0859
46;289,0625
47;295,8984
48;295,8984
49;301,7578
50;303,7109
51;307,6172
52;311,5234
53;314,4531
54;317,3828
55;320,3125
56;326,1719
57;330,0781
58;331,0547
59;333,0078
60;336,9141
61;338,8672
62;340,8203
63;343,75
64;347,6563
65;351,5625
66;356,4453
67;359,375
68;366,2109
69;366,2109
70;371,0938
71;375
72;374,0234
73;379,8828
74;384,7656
75;388,6719
76;388,6719
77;389,6484
78;392,5781
79;395,5078
80;396,4843
81;399,414
82;405,2734
83;407,2266
84;412,1094
85;414,0625
86;417,9687
87;420,8984
88;417,9687
89;417,9687
90;416,9922
91;418,9453
92;419,9219
93;436,5235
94;458,9843
95;474,6094
96;481,4453
97;487,3047
98;488,2812
99;500
100;503,9063
101;500
102;510,7422
103;507,8125
104;513,6719
105;515,625
106;526,3672
107;529,2969
108;532,2266
109;540,0391
110;544,9219
111;554,6875
112;556,6406
113;558,5938
114;567,3828
115;568,3594
116;576,1719
117;578,125
118;588,8671
119;591,7969
120;598,6328
121;602,5391
122;610,3516
123;619,1406
124;625
125;626,9531
126;634,7656
127;636,7188
128;640,6249
129;639,6484
130;651,3672
131;656,25
132;662,1093
133;660,1563
134;666,0156
135;674,8047
136;679,6875
137;685,5469
138;698,2422
139;706,0547
140;699,2188
141;713,8671
142;715,8203
143;722,6563
144;727,5391
145;734,375
146;739,2578
147;744,1406
148;751,9531
149;757,8125
150;764,6484
151;769,5312
152;776,3672
153;780,2735
154;785,1563
155;792,9687
156;795,8984
157;800,7813
158;803,7109
159;811,5234
160;814,4531
161;814,4531
162;823,2422
163;830,0781
164;832,0313
165;833,0079
166;841,7968
167;849,6094
168;856,4453
169;858,3984
170;855,4688
171;855,4688
172;859,3751
173;860,3516
174;877,9297
175;870,1172
176;967,7734
177;937,5
178;884,7656
179;891,6015
180;881,8359
181;898,4375
182;895,5079
183;894,5313
184;897,4609
185;907,2266
186;898,4375
187;905,2734
188;900,3906
189;0
190;0
191;0
192;0
193;0
194;0
195;0
196;0
197;0
198;0
199;0
200;30,27344
201;0
202;0
203;0
204;0
205;0
206;0
207;0
208;0
209;0
210;0
211;0
212;0
213;0
214;0
215;0
216;0
217;0
218;0
219;0
220;0
221;0
222;0
223;0
224;0
225;0
226;0
227;0
228;0
229;0
230;0
231;0
232;0
233;0
234;0
235;0
236;0
237;0
238;0
239;0
240;0
241;0
242;0
243;0
244;0
245;0
246;0
247;0
248;0
249;0
250;0
)
return |
#include grapher.ahk mit tonne's erweiterung
| Code: | ;;;;;;;;;;;;;;;
;
; Function Grapher by jonny
; (with code by Laszlo)
;
;
;;;Functions;;;
;
;GraphCreate(id,x,y,w,h,pre="")
; Initializes the graph, sets its options,
; and draws it at the specified location.
; Returns 1 if it's successful, 0 if there's
; a logical error (e.g. bad option), and blank
; if there's a problem allocating memory.
;
; id:
; The window ID (ahk_id) of the window to
; draw the graph on.
;
; x:
; The x-coordinate to draw the graph at.
;
; y:
; The y-coordinate to draw the graph at.
;
; w:
; The width of the graph.
;
; h:
; The height of the graph.
;
; pre:
; The prefix for the global option variables,
; explained further below.
; For example, if pre = "GraphOpts_", then it
; will read GraphOpts_xScl for the xScl option
;
;
;Graph(equation,color=defGraphColor)
; Computes and draws the given equation on
; the graph. The equation must be in terms
; of the variable 'x', and it can contain any
; standard AHK operators and math functions.
; Returns 1 if it's successful, and 0 if
; the graph doesn't exist or if there's a
; problem with the computation.
;
; equation:
; The equation to use. This must be in the form
; of a string, NOT a bare expression; however,
; it will eventually be parsed, so it must be
; valid as an expression.
;
; color:
; The color to draw the equation in. This must
; be in RGB form (0xRRGGBB), not an HTML color.
; If this parameter is unspecified or not a valid
; RGB color, the defGraphColor option will be used.
;
;
;GraphClear()
; Clears all equations off the graph.
;
;
;GraphDraw()
; Redraws the graph. Shouldn't be necessary to
; use, since GraphCreate binds this to WM_PAINT.
;
;
;GraphDestroy()
; Frees all memory associated with the graph.
; You MUST call this before exiting the script,
; or there will be a memory leak.
; Note that this will not remove the graph's image
; from the display. The window must be redrawn
; to visually clear it.
;
;
;
;;;Options;;;
;
; To use these, set any of them as global variables
; with a consistent prefix (required). Then pass
; the prefix to GraphCreate as a string, via the
; 'pre' parameter. Any options left unset will get
; their default values.
;
;
;paperColor (0xFFFFFF - white)
; The color of the graph's background, or the
; "graph paper." Must be a full RGB color.
;
;axisColor (0x000000 - black)
; The color of the x and y axes, if visible.
; Must be a full RGB color.
;
;gridColor (0xDFDFDF - light grey)
; The color of the grid beneath the graph.
; Must be a full RGB color.
;
;defGraphColor (0x0000FF - blue)
; The default color for Graph(), if the 'color'
; parameter isn't valid or specified.
;
;lineWidth (3)
; The width of the lines generated by Graph().
; Must be greater than or equal to zero.
;
;xScl (1)
; The scale of the x-plane of the grid, in
; logical units. For instance, a value of 10
; would draw a vertical line wherever x is
; a multiple of 10, and a value of 0.5 would
; draw two vertical lines for every integral
; x-value. Must be greater than zero.
;
;yScl (1)
; The scale of the y-plane of the grid, in
; logical units. Same as above, except for
; the horizontal lines with y. Must be greater
; than zero.
;
;xMin (-10)
; The smallest x-value displayed on the graph,
; or the left edge of its viewable area. Must
; be less than xMax.
;
;yMin (-10)
; The smallest y-value displayed on the graph,
; or the bottom edge of its viewable area. Must
; be less than yMax.
;
;xMax (10)
; The largest x-value displayed on the graph,
; or the right edge of its viewable area. Must
; be greater than xMin.
;
;yMax (10)
; The largest y-value displayed on the graph,
; or the top edge of its viewable area. Must be
; greater than yMin.
;
;
;
;;;Remarks;;;
;
; Use this at your own risk. I've tested it a lot,
; but there's still a chance it'll cause a serious
; memory leak.
;
; Avoid naming any global variables with the prefix
; '__graph_' while the graph is created, since these
; functions use it to communicate.
;
; Graph() uses two temporary files which it creates
; in A_Temp, so don't be alarmed if you notice that
; your script is suddenly opening weird files. (It
; deletes them when it's finished, so they'll only
; consume space for a few milliseconds.)
;
GraphCreate(WindowID,xCoord,yCoord,Width,Height,OptPre="")
{
global
local paperColor,axisColor,gridColor,xScl,yScl,xMin,yMin
,xMax,yMax,Pen,Brush
if __graph_Exists
return 0
;options
;background color (white)
paperColor := %OptPre%paperColor ? %OptPre%paperColor : 0xFFFFFF
;color for axes (black)
axisColor := %OptPre%axisColor ? %OptPre%axisColor : 0x000000
;grid color (grey)
gridColor := %OptPre%gridColor ? %OptPre%gridColor : 0xDFDFDF
;default color for new equations (blue)
__graph_color := %OptPre%defGraphColor ? %OptPre%defGraphColor : 0x0000FF
;width of equations' graphs
__graph_lineWidth := %OptPre%lineWidth ? %OptPre%lineWidth : 3
;scale of grid for the x plane
xScl := %OptPre%xScl ? %OptPre%xScl : 1
;scale of grid for the y plane
yScl := %OptPre%yScl ? %OptPre%yScl : 1
;lowest x-value shown on graph
xMin := %OptPre%xMin ? %OptPre%xMin : -10
;lowest y-value shown on graph
yMin := %OptPre%yMin ? %OptPre%yMin : -10
;highest x-value shown on graph
xMax := %OptPre%xMax ? %OptPre%xMax : 10
;highest y-value shown on graph
yMax := %OptPre%yMax ? %OptPre%yMax : 10
;sanity checks
if (paperColor > 0xFFFFFF || paperColor < 0
|| axisColor > 0xFFFFFF || axisColor < 0
|| gridColor > 0xFFFFFF || gridColor < 0
|| __graph_color > 0xFFFFFF || __graph_color < 0
|| __graph_lineWidth < 0
|| xScl <= 0 || yScl <= 0
|| xMin >= xMax || yMin >= yMax)
{
__graph_color =
__graph_lineWidth =
return 0
}
__graph_X := xCoord
__graph_Y := yCoord
__graph_W := Width
__graph_H := Height
;compute how many units on the graph each pixel
;corresponds to
__graph_xUnit := Width / (xMax - xMin)
__graph_yUnit := Height / (yMax - yMin)
;how far, in graph units, the left
;edge is from the origin
__graph_leftDist := xMin * __graph_xUnit
;how far the top edge is from the
;origin, this time in terms of y
__graph_topDist := yMax * __graph_yUnit
;Device Context for the window to be drawn to
__graph_WindowDC := DllCall("GetDC", UInt,WindowID)
if not __graph_WindowDC
return
;first memory DC, containing the "graph paper,"
;the background of the graph
__graph_PaperDC := DllCall("CreateCompatibleDC", UInt,WindowDC)
if not __graph_PaperDC
return
;create a bitmap on the DC
__graph_PaperDC_BM := DllCall("CreateCompatibleBitmap"
, UInt,__graph_WindowDC, UInt,Width, UInt,Height)
DllCall("SelectObject", UInt,__graph_PaperDC
, UInt,__graph_PaperDC_BM)
;second Memory DC, containing the finished product
;of the paper with the graphed equations on it
__graph_MemoryDC := DllCall("CreateCompatibleDC", UInt,WindowDC)
if not __graph_MemoryDC
return
;create a bitmap on the DC
__graph_MemoryDC_BM := DllCall("CreateCompatibleBitmap"
, UInt,__graph_WindowDC, UInt,Width, UInt,Height)
DllCall("SelectObject", UInt,__graph_MemoryDC
, UInt,__graph_MemoryDC_BM)
;set up the graph paper
;first the background and border
Pen := DllCall("CreatePen", UInt,0, UInt,0, UInt,paperColor)
DllCall("SelectObject", UInt,__graph_PaperDC, UInt,Pen)
Brush := DllCall("CreateSolidBrush", UInt,paperColor)
DllCall("SelectObject", UInt,__graph_PaperDC, UInt,Brush)
DllCall("Rectangle", UInt,__graph_PaperDC, UInt,0, UInt,0
, UInt,Width, UInt,Height)
DllCall("DeleteObject", UInt,Pen)
DllCall("DeleteObject", UInt,Brush)
;now the grid
Pen := DllCall("CreatePen", UInt,0, UInt,0, UInt,gridColor)
DllCall("SelectObject", UInt,__graph_PaperDC, UInt,Pen)
;vertical lines (x-plane)
Loop
{
if (A_Index >= ( (xMax - xMin) / xScl ))
break
DllCall("MoveToEx", UInt,__graph_PaperDC
, UInt,Round(A_Index*__graph_xUnit*xScl), UInt,0, UInt,0)
DllCall("LineTo", UInt,__graph_PaperDC
, UInt,Round(A_Index*__graph_xUnit*xScl), UInt,Height)
}
;horizontal lines (y-plane)
Loop
{
if (A_Index >= ( (yMax - yMin) / yScl ))
break
DllCall("MoveToEx", UInt,__graph_PaperDC
, UInt,0, UInt,Round(A_Index*__graph_yUnit*yScl), UInt,0)
DllCall("LineTo", UInt,__graph_PaperDC
, UInt,Width, UInt,Round(A_Index*__graph_yUnit*yScl))
}
DllCall("DeleteObject", UInt,Pen)
;axes
Pen := DllCall("CreatePen", UInt,0, UInt,0, UInt,axisColor)
DllCall("SelectObject", UInt,__graph_PaperDC, UInt,Pen)
if (xMin < 0 and xMax > 0)
{
DllCall("MoveToEx", UInt,__graph_PaperDC
, UInt,Round((-xMin)*__graph_xUnit), UInt,0, UInt,0)
DllCall("LineTo", UInt,__graph_PaperDC
, UInt,Round((-xMin)*__graph_xUnit), UInt,Height)
}
if (yMin < 0 and yMax > 0)
{
DllCall("MoveToEx", UInt,__graph_PaperDC
, UInt,0, UInt,Round(yMax*__graph_yUnit), UInt,0)
DllCall("LineTo", UInt,__graph_PaperDC
, UInt,Width, UInt,Round(yMax*__graph_yUnit))
}
DllCall("DeleteObject", UInt,Pen)
__graph_Exists := true
GraphClear()
;WM_PAINT: 0x0F
OnMessage(0x0F,"GraphDraw")
return 1
}
Graph(Equation,Color = -1)
{
global
local Pen,FirstVal,GraphSpec,R,G,B
if (!__graph_Exists or !A_AhkPath)
return 0
if (Color < 0 or Color > 0xFFFFFF)
Color := __graph_color
;CreatePen expects a BGR-formatted COLORREF
R := Color & 0x0000FF
G := Color & 0x00FF00
B := Color & 0xFF0000
R <<= 16
B >>= 16
Color := R | G | B
;px/py: Positional coordinates used to
; place the graph
;
;x/y: Actual coordinates that the function
; is computed in
;
;Equation must be in terms of 'x'
Loop %__graph_W%
{
px := A_Index
x := (px + __graph_leftDist) / __graph_xUnit
y := Eval("x:=" . x . "; " . Equation) * __graph_yUnit
py := Round(__graph_topDist - y)
GraphSpec .= py . ";"
}
Pen := DllCall("CreatePen", UInt,0, UInt,__graph_lineWidth, UInt,Color)
DllCall("SelectObject", UInt,__graph_MemoryDC, UInt,Pen)
StringTrimRight,GraphSpec,GraphSpec,1
FirstVal := InStr(GraphSpec,";")
DllCall("MoveToEx", UInt,__graph_MemoryDC, UInt,1, UInt,SubStr(GraphSpec,1,FirstVal-1), UInt,0)
StringTrimLeft,GraphSpec,GraphSpec,FirstVal
Loop,Parse,GraphSpec,;
DllCall("LineTo", UInt,__graph_MemoryDC, UInt,A_Index + 1, UInt,A_LoopField)
DllCall("DeleteObject", UInt,Pen)
GraphDraw()
return 1
}
GraphClear()
{
global
if not __graph_Exists
return
DllCall("BitBlt", UInt,__graph_MemoryDC, UInt,0, UInt,0
, UInt,__graph_W, UInt,__graph_H, UInt,__graph_PaperDC
, UInt,0, UInt,0, UInt,0x00CC0020)
GraphDraw()
}
GraphDraw()
{
global
if not __graph_Exists
return
DllCall("BitBlt", UInt,__graph_WindowDC, UInt,__graph_X
, UInt,__graph_Y, UInt,__graph_W, UInt,__graph_H
, UInt,__graph_MemoryDC, UInt,0, UInt,0, UInt,0x00CC0020)
}
GraphDestroy()
{
global
;WM_PAINT: 0x0F
OnMessage(0x0F,"")
DllCall("DeleteObject", UInt,__graph_PaperDC)
DllCall("DeleteObject", UInt,__graph_PaperDC_BM)
DllCall("DeleteObject", UInt,__graph_MemoryDC)
DllCall("DeleteObject", UInt,__graph_MemoryDC_BM)
DllCall("ReleaseDC", UInt,0, UInt,__graph_WindowDC)
__graph_PaperDC =
__graph_PaperDC_BM =
__graph_MemoryDC =
__graph_MemoryDC_BM =
__graph_WindowDC =
__graph_X =
__graph_Y =
__graph_W =
__graph_H =
__graph_color =
__graph_lineWidth =
__graph_xUnit =
__graph_yUnit =
__graph_leftDist =
__graph_topDist =
__graph_Exists =
}
;; Taken from Laszlo's "Monster" expression evaluation script (version 20070301):
;; http://www.autohotkey.com/forum/viewtopic.php?t=17058
Eval(x) { ; PRE/POST PROCESSING (Global Dynamic vars, Array y: y1, y2, y3)
Local FORM, i, z
SetFormat Integer, D ; decimal intermediate results!
RegExMatch(x, "\$(b|h|x|\d*)", y)
FORM := y1 ; HeX, Bin, .{digits} output format
SetFormat FLOAT, % y1 >= 0 ? "0." . y1 : 0.6 ; Default = 6 decimal
StringReplace x, x, %y% ; remove ${num}
x := RegExReplace(x,"\s*") ; remove whitespace
If RegExMatch(x, "(.*);(.*)", u) {
z := u2 ; workaround local-global mixup with arrays
Eval(u1)
Return Eval(z)
}
StringGetPos i, x, := ; execute leftmost ":=" operator
If (i >= 0) {
z := "x" . SubStr(x,1,i) ; user vars start with x to avoid name conflicts
Return %z% := Eval(SubStr(x,3+i))
}
StringReplace x, x,`%, \, All ; % -> \ for MOD
StringReplace x, x, **, @, All ; ** -> @ for easier process
Loop {
If !RegExMatch(x, "i)(.*)(0x[a-f\d]*)(.*)", y)
Break
x := y1 . y2+0 . y3 ; convert hex numbers to decimal
}
Loop {
If !RegExMatch(x, "(.*)'([01]*)(.*)", y)
Break
x := y1 . FromBin(y2) . y3 ; convert binary numbers to decimal: sign = first bit
}
x := RegExReplace(x,"([a-z_A-Z]\w*)([^\w\(\]]|$)","%x$1%$2") ; var -> %var%; func(.., [op] remains
Transform x, Deref, %x% ; dereference all %var%
StringReplace x, x, -, #, All ; # = subtraction, different from sign
x := RegExReplace(x, "(^|\(|\])\+", "$1") ; (+x -> (x, ]+x -> ]x
Loop { ; find innermost (..)
If !RegExMatch(x, "(.*)\(([^\(\)]*)\)(.*)", y)
Break
x := y1 . Eval@(y2) . y3 ; replace "(x)" with value of x
}
If FORM is Digit ; return result: no more (..)
Return Eval@(x)
If FORM = b ; binary
Return ToBin(Eval@(x))
x := Eval@(x) ; Hex
SetFormat Integer, Hex
Return x+0
}
Eval@(x) { ; EVALUATE PRE-PROCESSED EXPRESSIONS
IfEqual x,, Return 0 ; empty = 0
StringGetPos i, x, ||, R ; execute rightmost || operator
IfGreaterOrEqual i,0, Return Eval@(SubStr(x,1,i)) || Eval@(SubStr(x,3+i))
StringGetPos i, x, &&, R ; execute rightmost && operator
IfGreaterOrEqual i,0, Return Eval@(SubStr(x,1,i)) && Eval@(SubStr(x,3+i))
; execute rightmost =, <> operator
RegExMatch(x, "(.*)([^\<\>])(\<\>|=)(.*)", y)
IfEqual y3,=, Return Eval@(y1 . y2) = Eval@(y4)
IfEqual y3,<>, Return Eval@(y1 . y2) <> Eval@(y4)
; execute rightmost <,>,<=,>= operator
RegExMatch(x, "(.*)([^\<\>])(\<=?|\>=?)([^\<\>])(.*)", y)
IfEqual y3,<, Return Eval@(y1 . y2) < Eval@(y4 . y5)
IfEqual y3,>, Return Eval@(y1 . y2) > Eval@(y4 . y5)
IfEqual y3,<=, Return Eval@(y1 . y2) <= Eval@(y4 . y5)
IfEqual y3,>=, Return Eval@(y1 . y2) >= Eval@(y4 . y5)
; execute rightmost user operator (low precedence)
RegExMatch(x, "i)(.*)(\[gcd\]|\[min\]|\[max\]|\[choose\])(.*)", y)
IfEqual y2,[Gcd], Return GCD( Eval@(y1),Eval@(y3))
IfEqual y2,[Min], Return Min( Eval@(y1),Eval@(y3))
IfEqual y2,[Max], Return Max( Eval@(y1),Eval@(y3))
IfEqual y2,[choose],Return Choose(Eval@(y1),Eval@(y3))
StringGetPos i, x, |, R ; execute rightmost | operator
IfGreaterOrEqual i,0, Return Eval@(SubStr(x,1,i)) | Eval@(SubStr(x,2+i))
StringGetPos i, x, ^, R ; execute rightmost ^ operator
IfGreaterOrEqual i,0, Return Eval@(SubStr(x,1,i)) ^ Eval@(SubStr(x,2+i))
StringGetPos i, x, &, R ; execute rightmost & operator
IfGreaterOrEqual i,0, Return Eval@(SubStr(x,1,i)) & Eval@(SubStr(x,2+i))
; execute rightmost <<, >> operator
RegExMatch(x, "(.*)(\<\<|\>\>)(.*)", y)
IfEqual y2,<<, Return Eval@(y1) << Eval@(y3)
IfEqual y2,>>, Return Eval@(y1) >> Eval@(y3)
; execute rightmost +- (not unary) operator
RegExMatch(x, "(.*[^\(\@\*\/\\\~\+\#])(\+|\#)(.*)", y) ; lower precedence ops are already handled
IfEqual y2,+, Return Eval@(y1) + Eval@(y3)
IfEqual y2,#, Return Eval@(y1) - Eval@(y3)
; execute rightmost */% operator
RegExMatch(x, "(.*)(\*|\/|\\)(.*)", y)
IfEqual y2,*, Return Eval@(y1) * Eval@(y3)
IfEqual y2,/, Return Eval@(y1) / Eval@(y3)
IfEqual y2,\, Return Mod(Eval@(y1),Eval@(y3))
; execute rightmost power
StringGetPos i, x, @, R
IfGreaterOrEqual i,0, Return Eval@(SubStr(x,1,i)) ** Eval@(SubStr(x,2+i))
; execute rightmost function
If !RegExMatch(x,"i)(.*)(\+|\#|\~|Abs|Ceil|Exp|Floor|Log|Ln|Round|Sqrt|Sin|Cos|Tan|ASin|ACos|ATan|Sgn|Fib|fac)([-\d\.]*)", y)
Return x ; no more function
IfEqual y2,+,Return Eval@(y1 . y3) ; unary + and...
IfEqual y2,#,Return Eval@(y1 . -y3) ; unary - and...
IfEqual y2,~,Return Eval@(y1 . ~y3) ; unary ~ behaves like a function
GoTo %y2% ; functions checked last: y3 is number
Abs:
Return Eval@(y1 . Abs(y3))
Ceil:
Return Eval@(y1 . Ceil(y3))
Exp:
Return Eval@(y1 . Exp(y3))
Floor:
Return Eval@(y1 . Floor(y3))
Log:
Return Eval@(y1 . Log(y3))
Ln:
Return Eval@(y1 . Ln(y3))
Round:
Return Eval@(y1 . Round(y3))
Sqrt:
Return Eval@(y1 . Sqrt(y3))
Sin:
Return Eval@(y1 . Sin(y3))
Cos:
Return Eval@(y1 . Cos(y3))
Tan:
Return Eval@(y1 . Tan(y3))
ASin:
Return Eval@(y1 . ASin(y3))
ACos:
Return Eval@(y1 . ACos(y3))
ATan:
Return Eval@(y1 . ATan(y3))
Sgn:
Return Eval@(y1 . Sgn(y3))
Fib:
Return Eval@(y1 . Fib(y3))
Fac:
Return Eval@(y1 . Fac(y3))
}
ToBin(n) { ; Binary representation of n. 1st bit is SIGN: -8 -> 1000, -1 -> 11, 0 -> 0, 8 -> 01000
m := -(n<0)
Loop {
b := n&1 . b
If (m = n >>= 1)
Return b = "0" ? b : -m . b
}
}
FromBin(bits) { ; Number converted from the binary "bits" string, 1st bit is SIGN
n = 0
Loop Parse, bits
n += n + A_LoopField
Return n - (SubStr(bits,1,1)<<StrLen(bits))
}
MIN(a,b) { ; The less of a, b
Return a<b ? a : b
}
MAX(a,b) { ; The greater of a, b
Return a>b ? a : b
}
GCD(a,b) { ; Euclidean GCD
Return b=0 ? Abs(a) : GCD(b, mod(a,b))
}
Choose(n,k) { ; Binomial coefficient
p := 1, i := 0, k := k < n-k ? k : n-k
Loop %k%
p *= (n-i)/(k-i), i+=1
Return Round(p)
}
Sgn(x) { ; Sign of x
Return (x>0)-(x<0)
}
Fib(n) { ; n-th Fibonacci number (iterative to avoid globals)
a := 0, b := 1
Loop % n-1
c := b, b += a, a := c
Return b
}
fac(n) { ; n!
Return n<2 ? 1 : n*fac(n-1)
}
GraphLine(xname, yname, size, Color = -1)
{
global
local EquDC,EquDC_BM,Pen,FirstVal,GraphSpec,R,G,B,Xxx,Yyy
if (!__graph_Exists or !A_AhkPath)
return 0
if (Color < 0 or Color > 0xFFFFFF)
Color := __graph_color
;CreatePen expects a BGR-formatted COLORREF
R := Color & 0x0000FF
G := Color & 0x00FF00
B := Color & 0xFF0000
R <<= 16
B >>= 16
Color := R | G | B
Pen := DllCall("CreatePen", UInt,0, UInt,__graph_lineWidth, UInt,Color)
DllCall("SelectObject", UInt,__graph_MemoryDC, UInt,Pen)
loop %size%
{
xentry := %xname%%a_index%
yentry := %yname%%a_index%
Xxx := xentry
Yyy := yentry
if a_index = 1
DllCall("MoveToEx", UInt,__graph_MemoryDC, UInt, Xxx, UInt, Yyy, UInt, 0)
else
DllCall("LineTo", UInt,__graph_MemoryDC, UInt, Xxx, UInt, Yyy)
}
DllCall("DeleteObject", UInt,Pen)
GraphDraw()
return 1
}
|
an deiner lösung habe ich sehr großes interesse,weil ich sie vielleicht besser verstehe und damit besser umsetzen kann...  _________________ Mit freundlichen Grüßen
fredchf |
|
| Nach oben |
|
 |
denick
Anmeldedatum: 15.09.2006 Beiträge: 1073 Wohnort: Berlin
|
Verfasst am: Fr Mai 09, 2008 7:37 am Titel: |
|
|
Moin fredchf,
es ist so weit, schau Dir das mal an http://de.autohotkey.com/forum/viewtopic.php?t=2920
Ich hatte noch ein paar Probleme, weil ich ursprünglich mit Progressbars gearbeitet habe, Deine 250 Werte das aber recht unansehnlich aussehen liessen. Dann kamen mir die Pictures in den Sinn und ich glaube, das Ergebnis kann sich halbwegs sehen lassen.
Viel Spaß!
 _________________ Hilfe zur Hilfe
(de)nick |
|
| Nach oben |
|
 |
fredchf
Anmeldedatum: 18.09.2006 Beiträge: 665 Wohnort: Deutschland
|
Verfasst am: Fr Mai 09, 2008 10:30 am Titel: |
|
|
hallo denick!
ich habe schon mit großer spannung deine lösung erwartet,echt klasse!
ich muss mich damit erst noch genauer beschäftigen,aber das ergebniss ist sehr überzeugend,danke! _________________ Mit freundlichen Grüßen
fredchf |
|
| Nach oben |
|
 |
|
|
Du kannst Beiträge in dieses Forum schreiben. Du kannst auf Beiträge in diesem Forum antworten.
|
Powered by phpBB © 2001, 2005 phpBB Group Deutsche Übersetzung von phpBB.de
|