質問編集履歴
3
ソースコードの再修正。
    
        title	
    CHANGED
    
    | 
            File without changes
         | 
    
        body	
    CHANGED
    
    | @@ -22,7 +22,7 @@ | |
| 22 22 | 
             
                lazy var labels: [String] = self.generateSequentialLabels(self.numberOfDataItems, text: "Time")
         | 
| 23 23 |  | 
| 24 24 |  | 
| 25 | 
            -
             | 
| 25 | 
            +
            //変更点有り
         | 
| 26 26 | 
             
                override func viewDidLoad() {
         | 
| 27 27 | 
             
                    super.viewDidLoad()
         | 
| 28 28 | 
             
                    print(self.ecgGraph.bounds.width)
         | 
| @@ -37,6 +37,7 @@ | |
| 37 37 |  | 
| 38 38 | 
             
                }
         | 
| 39 39 |  | 
| 40 | 
            +
            //変更点有り
         | 
| 40 41 | 
             
                override func viewDidLayoutSubviews() {
         | 
| 41 42 | 
             
                    super.viewDidLayoutSubviews()
         | 
| 42 43 | 
             
                    //サイズ設定
         | 
| @@ -44,8 +45,7 @@ | |
| 44 45 | 
             
                    graphView.frame = rect
         | 
| 45 46 | 
             
                }
         | 
| 46 47 |  | 
| 47 | 
            -
             | 
| 48 | 
            +
            //変更点有り
         | 
| 48 | 
            -
             | 
| 49 49 | 
             
                fileprivate func createDarkGraph() {
         | 
| 50 50 | 
             
            //        let graphView = ScrollableGraphView(frame: frame)
         | 
| 51 51 |  | 
| @@ -104,7 +104,6 @@ | |
| 104 104 | 
             
                    }
         | 
| 105 105 | 
             
                    return labels
         | 
| 106 106 | 
             
                }
         | 
| 107 | 
            -
                
         | 
| 108 107 | 
             
                override func didReceiveMemoryWarning() {
         | 
| 109 108 | 
             
                    super.didReceiveMemoryWarning()
         | 
| 110 109 | 
             
                    // Dispose of any resources that can be recreated.
         | 
2
ソースコードの修正。
    
        title	
    CHANGED
    
    | 
            File without changes
         | 
    
        body	
    CHANGED
    
    | @@ -27,19 +27,27 @@ | |
| 27 27 | 
             
                    super.viewDidLoad()
         | 
| 28 28 | 
             
                    print(self.ecgGraph.bounds.width)
         | 
| 29 29 | 
             
                    print(self.ecgGraph.bounds.height)
         | 
| 30 | 
            -
                    graphView = ScrollableGraphView(frame: self.view.frame)
         | 
| 30 | 
            +
            //        graphView = ScrollableGraphView(frame: self.view.frame)
         | 
| 31 | 
            -
                    graphView = createDarkGraph(self.view.frame)
         | 
| 31 | 
            +
            //        graphView = createDarkGraph(self.view.frame)
         | 
| 32 | 
            +
                    createDarkGraph()
         | 
| 32 33 |  | 
| 33 34 | 
             
                    graphView.set(data: data, withLabels: labels)
         | 
| 34 | 
            -
                    
         | 
| 35 35 | 
             
                    self.ecgGraph.clipsToBounds = true
         | 
| 36 36 | 
             
                    self.ecgGraph.addSubview(graphView)
         | 
| 37 37 |  | 
| 38 38 | 
             
                }
         | 
| 39 | 
            +
                
         | 
| 40 | 
            +
                override func viewDidLayoutSubviews() {
         | 
| 41 | 
            +
                    super.viewDidLayoutSubviews()
         | 
| 42 | 
            +
                    //サイズ設定
         | 
| 43 | 
            +
                    let rect = CGRect(x:0, y:0, width:ecgGraph.frame.width, height:ecgGraph.frame.height) //Swift3.0
         | 
| 44 | 
            +
                    graphView.frame = rect
         | 
| 45 | 
            +
                }
         | 
| 39 46 |  | 
| 40 47 |  | 
| 48 | 
            +
             | 
| 41 | 
            -
                fileprivate func createDarkGraph( | 
| 49 | 
            +
                fileprivate func createDarkGraph() {
         | 
| 42 | 
            -
                    let graphView = ScrollableGraphView(frame: frame)
         | 
| 50 | 
            +
            //        let graphView = ScrollableGraphView(frame: frame)
         | 
| 43 51 |  | 
| 44 52 | 
             
                    graphView.backgroundFillColor = UIColor.colorFromHex(hexString: "#333333")
         | 
| 45 53 |  | 
| @@ -71,9 +79,9 @@ | |
| 71 79 | 
             
                    graphView.rangeMax = 50
         | 
| 72 80 | 
             
                    graphView.shouldRangeAlwaysStartAtZero = true
         | 
| 73 81 |  | 
| 74 | 
            -
                    graphView.setNeedsDisplay()
         | 
| 82 | 
            +
            //        graphView.setNeedsDisplay()
         | 
| 75 | 
            -
                    
         | 
| 83 | 
            +
                    return
         | 
| 76 | 
            -
                    return graphView
         | 
| 84 | 
            +
            //        return graphView
         | 
| 77 85 | 
             
                }
         | 
| 78 86 |  | 
| 79 87 | 
             
                private func generateRandomData(_ numberOfItems: Int, max: Double) -> [Double] {
         | 
| @@ -101,6 +109,8 @@ | |
| 101 109 | 
             
                    super.didReceiveMemoryWarning()
         | 
| 102 110 | 
             
                    // Dispose of any resources that can be recreated.
         | 
| 103 111 | 
             
                }
         | 
| 112 | 
            +
                
         | 
| 113 | 
            +
             | 
| 104 114 | 
             
            }
         | 
| 105 115 |  | 
| 106 116 |  | 
1
GithubのURLを有効にしました!
    
        title	
    CHANGED
    
    | 
            File without changes
         | 
    
        body	
    CHANGED
    
    | @@ -4,7 +4,7 @@ | |
| 4 4 | 
             
            上記の図がアプリの構成画面かつ現状のグラフになります。自分としましては、縦軸のメモリを0から表示させ縦軸と横軸を表示させたいと思っています。(グラフはスクロールするとどんどん違う日の心電図が表示されるようになります。)
         | 
| 5 5 |  | 
| 6 6 | 
             
            【開発フロー】
         | 
| 7 | 
            -
            ①Scrollable-GraphView | 
| 7 | 
            +
            ①[Scrollable-GraphView](https://github.com/philackm/Scrollable-GraphView)というライブラリを参照しコードを実装。
         | 
| 8 8 | 
             
            ②clipsToBoundsを用いグラフのサイズを抑える。
         | 
| 9 9 | 
             
            ③グラフの表示のされ方に問題発生!(今ここ←)
         | 
| 10 10 |  | 
