Changeset 1619 for trunk/examples/objects/api/tcl/plot
- Timestamp:
- Nov 25, 2009 10:40:35 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/examples/objects/api/tcl/plot
r1610 r1619 161 161 $p color 162 162 # "" 163 $p color "no color"163 $p color "no color" 164 164 $p color 165 165 # "no color" … … 366 366 # [ [1 2 3 4 5 6 7 8 9 10] \ 367 367 # [1 8 27 64 125 216 343 512 729 1000] ] ] 368 put [$p count]368 puts [$p count] 369 369 # 3 370 370 … … 432 432 Notes: object is configured based on values in "c" 433 433 Code Example: 434 {{{ 435 set p [Rappture.Plot] 436 set xmldata { 437 <?xml version="1.0"> 438 <curve id="xsquared"> 439 <about> 440 <group>auto34</group> 441 <label>x squared</label> 442 <description>x values are squared</description> 443 <type></type> 444 <format>g:o</format> 445 </about> 446 <xaxis> 447 <label>x values</label> 448 <description>values being squared</description> 449 <units></units> 450 <scale>linear</scale> 451 </xaxis> 452 <yaxis> 453 <label>y values</label> 454 <description>squared values</description> 455 <units></units> 456 <scale>linear</scale> 457 </yaxis> 458 <component> 459 <xy> 1 1 460 2 4 461 3 9 462 4 16 463 5 25 464 6 36 465 7 49 466 8 64 467 9 81 468 10 100 469 </xy> 470 </component> 471 </curve> 472 <curve id="xcubed"> 473 <about> 474 <group>auto34</group> 475 <label>x cubed</label> 476 <description>x values are cubed</description> 477 <type></type> 478 <format>b-o</format> 479 </about> 480 <xaxis> 481 <label>x values</label> 482 <description>values being cubed</description> 483 <units></units> 484 <scale>linear</scale> 485 </xaxis> 486 <yaxis> 487 <label>y values</label> 488 <description>cubed values</description> 489 <units></units> 490 <scale>linear</scale> 491 </yaxis> 492 <component> 493 <xy> 1 1 494 2 8 495 3 27 496 4 64 497 5 125 498 6 216 499 7 343 500 8 512 501 9 729 502 10 1000 503 </xy> 504 </component> 505 </curve> 506 } 507 508 $p configure -as RPCONFIG_XML $xmldata 509 puts [$p vvalue] 510 # [ [ [1 2 3 4 5 6 7 8 9 10] \ 511 # [1 4 9 16 25 36 49 64 81 100] ] \ 512 # [ [1 2 3 4 5 6 7 8 9 10] \ 513 # [1 8 27 64 125 216 343 512 729 1000] ] ] 514 515 for {set cur 0} {$cur < [$p count]} {incr cur} { 516 set c [$p getNthCurve $cur] 517 puts [$c name] 518 puts [$c label] 519 puts [$c desc] 520 puts [$c format] 521 for {set axisCnt 0} {$axisCnt < [$c dims]} {incr axisCnt} { 522 set axis [$c getNthAxis $axisCnt] 523 puts [$axis label] 524 puts [$axis desc] 525 puts [$axis units] 526 puts [$axis scale] 527 puts [$axis data] 528 } 529 } 530 # xsquared 531 # x squared 532 # x values are squared 533 # g:o 534 # xaxis 535 # x values 536 # values being squared 537 # 538 # linear 539 # [1 2 3 4 5 6 7 8 9 10] 540 # yaxis 541 # y values 542 # squared values 543 # 544 # linear 545 # [1 4 9 16 25 36 49 64 81 100] 546 # xcubed 547 # x cubed 548 # x values are cubed 549 # b-o 550 # xaxis 551 # x values 552 # values being cubed 553 # 554 # linear 555 # [1 2 3 4 5 6 7 8 9 10] 556 # yaxis 557 # y values 558 # cubed values 559 # 560 # linear 561 # [1 8 27 64 125 216 343 512 729 1000] 562 563 }}} 434 564 435 565 dump -as <as> … … 447 577 Notes: None 448 578 Code Example: 579 {{{ 580 for {set i 0} {$i < 10} {incr i} { 581 lappend x $i 582 lappend y1 [expr pow($i,2)] 583 lappend y2 [expr pow($i,3)] 584 } 585 586 set p [Rappture::Plot] 587 $p add $x $y1 -format "g:o" -name "xsquared" 588 $p add $x $y2 -format "b-o" -name "xcubed" 589 puts [$p dump -as RPCONFIG_XML] 590 # <curve id="xsquared"> 591 # <about> 592 # <group>auto34</group> 593 # <label></label> 594 # <description></description> 595 # <type>(null)</type> 596 # <format>g:o</format> 597 # </about> 598 # <xaxis> 599 # <label></label> 600 # <description></description> 601 # <units></units> 602 # <scale>linear</scale> 603 # </xaxis> 604 # <yaxis> 605 # <label></label> 606 # <description></description> 607 # <units></units> 608 # <scale>linear</scale> 609 # </yaxis> 610 # <component> 611 # <xy> 1 1 612 # 2 4 613 # 3 9 614 # 4 16 615 # 5 25 616 # 6 36 617 # 7 49 618 # 8 64 619 # 9 81 620 # 10 100 621 # </xy> 622 # </component> 623 # </curve> 624 # <curve id="xcubed"> 625 # <about> 626 # <group>auto34</group> 627 # <label></label> 628 # <description></description> 629 # <type>(null)</type> 630 # <format>b-o</format> 631 # </about> 632 # <xaxis> 633 # <label></label> 634 # <description></description> 635 # <units></units> 636 # <scale>linear</scale> 637 # </xaxis> 638 # <yaxis> 639 # <label></label> 640 # <description></description> 641 # <units></units> 642 # <scale>linear</scale> 643 # </yaxis> 644 # <component> 645 # <xy> 1 1 646 # 2 8 647 # 3 27 648 # 4 64 649 # 5 125 650 # 6 216 651 # 7 343 652 # 8 512 653 # 9 729 654 # 10 1000 655 # </xy> 656 # </component> 657 # </curve> 658 659 }}} 449 660 450 661 outcome … … 454 665 Notes: None 455 666 Code Example: 667 {{{ 668 set p [Rappture::Plot] 669 set out [$p outcome] 670 if ([$out value] != 0) { 671 puts stderr [$out context] 672 puts stderr [$out remark] 673 } 674 }}} 675 456 676 457 677 is
Note: See TracChangeset
for help on using the changeset viewer.