{"action":"closed","issue":{"url":"https://api.github.com/repos/danielgindi/Charts/issues/3268","repository_url":"https://api.github.com/repos/danielgindi/Charts","labels_url":"https://api.github.com/repos/danielgindi/Charts/issues/3268/labels{/name}","comments_url":"https://api.github.com/repos/danielgindi/Charts/issues/3268/comments","events_url":"https://api.github.com/repos/danielgindi/Charts/issues/3268/events","html_url":"https://github.com/danielgindi/Charts/issues/3268","id":296957933,"number":3268,"title":"Line Chart Issue in CombinedChartView","user":{"login":"BertPorter","id":19476837,"avatar_url":"https://avatars3.githubusercontent.com/u/19476837?v=4","gravatar_id":"","url":"https://api.github.com/users/BertPorter","html_url":"https://github.com/BertPorter","followers_url":"https://api.github.com/users/BertPorter/followers","following_url":"https://api.github.com/users/BertPorter/following{/other_user}","gists_url":"https://api.github.com/users/BertPorter/gists{/gist_id}","starred_url":"https://api.github.com/users/BertPorter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BertPorter/subscriptions","organizations_url":"https://api.github.com/users/BertPorter/orgs","repos_url":"https://api.github.com/users/BertPorter/repos","events_url":"https://api.github.com/users/BertPorter/events{/privacy}","received_events_url":"https://api.github.com/users/BertPorter/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-02-14T02:42:47Z","updated_at":"2018-02-14T02:49:51Z","closed_at":"2018-02-14T02:49:51Z","author_association":"NONE","body":"I am creating a combination line chart and scatter chart. \r\nThe line chart is used to draw a limit outline on the graph and the scatter chart is used to plot the data. I use an array of 8 points to create the line chart.\r\nWhen I iterate over the entire array, it won't display the line chart.\r\nI had to break the data into 3 ChartDataEntry arrays in order to display the entire line chart.\r\nConsequently I have 3 legend items that I don't know how to get rid of. \r\nOut of curiosity I used the same array as scatter points and they display correctly (see second photo).\r\n\r\nIn Model:\r\n    let longCGLimitsChartWtsArray = [10275.0, 9702.0, 9702.0, 10694.0, 14994.1, 14994.0, 11400.0, 10275.0]\r\n    let longCGLimitsChartCGsArray = [196.9, 199.6, 218.0, 220.3, 215.7, 206.2, 196.9, 196.9]\r\n\r\nIn View Controller:\r\n\r\n       func longCGGraphUpdate() {\r\n        \r\n        // Set up GG limits chart\r\n        var longCGLimitsChartDataEntry = [ChartDataEntry]()\r\n        for i in 0..<5 {\r\n            let value = ChartDataEntry(x: WTBLData.sharedInstance.longCGLimitsChartCGsArray[i], y: WTBLData.sharedInstance.longCGLimitsChartWtsArray[i])\r\n            longCGLimitsChartDataEntry.append(value)\r\n        }\r\n        let longCGLimitsChartValues = LineChartDataSet(values: longCGLimitsChartDataEntry, label: \"\")\r\n        longCGLimitsChartValues.colors = [NSUIColor.black]\r\n        longCGLimitsChartValues.drawCirclesEnabled = false\r\n        longCGLimitsChartValues.drawValuesEnabled = false\r\n        \r\n        var longCGLimitsChartDataEntry2 = [ChartDataEntry]()\r\n        for i in 4..<6 {\r\n            let value = ChartDataEntry(x: WTBLData.sharedInstance.longCGLimitsChartCGsArray[i], y: WTBLData.sharedInstance.longCGLimitsChartWtsArray[i])\r\n            longCGLimitsChartDataEntry2.append(value)\r\n        }\r\n        let longCGLimitsChartValues2 = LineChartDataSet(values: longCGLimitsChartDataEntry2, label: \"\")\r\n        longCGLimitsChartValues2.colors = [NSUIColor.black]\r\n        longCGLimitsChartValues2.drawCirclesEnabled = false\r\n        longCGLimitsChartValues2.drawValuesEnabled = false\r\n        \r\n        var longCGLimitsChartDataEntry3 = [ChartDataEntry]()\r\n        for i in 5..<8{\r\n            let value = ChartDataEntry(x: WTBLData.sharedInstance.longCGLimitsChartCGsArray[i], y: WTBLData.sharedInstance.longCGLimitsChartWtsArray[i])\r\n            longCGLimitsChartDataEntry3.append(value)\r\n        }\r\n        let longCGLimitsChartValues3 = LineChartDataSet(values: longCGLimitsChartDataEntry3, label: \"\")\r\n        longCGLimitsChartValues3.colors = [NSUIColor.black]\r\n        longCGLimitsChartValues3.drawCirclesEnabled = false\r\n        longCGLimitsChartValues3.drawValuesEnabled = false\r\n\r\n        let lineData = LineChartData()\r\n        lineData.addDataSet(longCGLimitsChartValues)\r\n        lineData.addDataSet(longCGLimitsChartValues2)\r\n        lineData.addDataSet(longCGLimitsChartValues3)\r\n\r\n         // Set up empty wt chart value\r\n        let emptyWtChartValues = ScatterChartDataSet(values: [ChartDataEntry(x: WTBLData.sharedInstance.emptyWtLongCG, y: WTBLData.sharedInstance.wTBLPlistItems.emptyWt)], label: \"Empty Wt\")\r\n        emptyWtChartValues.colors = [NSUIColor.blue]\r\n        emptyWtChartValues.setScatterShape(.square)\r\n        emptyWtChartValues.drawValuesEnabled = false\r\n        \r\n        // Set up tof wt chart value\r\n        let tofWtChartValues = ScatterChartDataSet(values: [ChartDataEntry(x: WTBLData.sharedInstance.tOFGrossWtLongCG, y: WTBLData.sharedInstance.tOFGrossWt)], label: \"TOF Wt\")\r\n        tofWtChartValues.colors = [NSUIColor.magenta]\r\n        tofWtChartValues.setScatterShape(.triangle)\r\n        tofWtChartValues.drawValuesEnabled = false\r\n        \r\n        // Set up fuel burn chart values\r\n        var fuelBurnChartDataEntry = [ChartDataEntry]()\r\n        for i in 0..<WTBLData.sharedInstance.fuelBurnWtsArray.count {\r\n            let value = ChartDataEntry(x: WTBLData.sharedInstance.fuelBurnLongCGsArray[i], y: WTBLData.sharedInstance.fuelBurnWtsArray[i])\r\n            fuelBurnChartDataEntry.append(value)\r\n        }\r\n        let fuelBurnChartValues = ScatterChartDataSet(values: fuelBurnChartDataEntry, label: \"Fuel Burn\")\r\n        fuelBurnChartValues.colors = [NSUIColor.green]\r\n        fuelBurnChartValues.setScatterShape(.circle)\r\n        fuelBurnChartValues.drawValuesEnabled = false\r\n\r\n        // Combine all scatter data chart values\r\n        let scatterData = ScatterChartData()\r\n        scatterData.addDataSet(emptyWtChartValues)\r\n        scatterData.addDataSet(fuelBurnChartValues)\r\n        scatterData.addDataSet(tofWtChartValues)\r\n\r\n        // Combine Scatter and Line data\r\n        let combinedData = CombinedChartData()\r\n        combinedData.scatterData = scatterData\r\n        combinedData.lineData = lineData\r\n        \r\n        longCGGraphView.data = combinedData\r\n        \r\n        // Refresh chart with new data\r\n        longCGGraphView.notifyDataSetChanged()\r\n    }\r\n\r\n<img width=\"278\" alt=\"line chart\" src=\"https://user-images.githubusercontent.com/19476837/36184993-cb5626d6-10eb-11e8-8316-6306aaf3229e.png\">\r\n<img width=\"276\" alt=\"scatter chart\" src=\"https://user-images.githubusercontent.com/19476837/36184998-d20f71a8-10eb-11e8-8cbe-e1c52618477a.png\">\r\n"}}
{"actor":{"display_login":"BertPorter"}}