Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/douglasr/ciqtools-graphing
https://github.com/douglasr/ciqtools-graphing
ciq-tools connect-iq connectiq monkeyc
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/douglasr/ciqtools-graphing
- Owner: douglasr
- License: mit
- Created: 2023-11-07T23:13:59.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-05-09T17:33:11.000Z (9 months ago)
- Last Synced: 2024-05-09T20:49:50.204Z (9 months ago)
- Topics: ciq-tools, connect-iq, connectiq, monkeyc
- Language: Monkey C
- Homepage:
- Size: 6.84 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: changelog.txt
- Contributing: CONTRIBUTING.md
- License: LICENSE.txt
Awesome Lists containing this project
- awesome-garmin - ciqtools-graphing - A clone of the graphing functionality present within Garmin devices natively (2024-05-09) (Barrels / Older resources)
README
# CIQ Tools Graphing
(c)2023-2024 Douglas RobertsonAuthor: Douglas Robertson (GitHub: [douglasr](https://github.com/douglasr); Garmin Connect: dbrobert)
## Overview
For the best user experience and minial friction, it is usually ideal to try and keep the interface and flow on apps similar to the native Garmin functionality. As such, the CIQ Tools Graphic barrel is a clone of the graphing functionality present within Garmin devices natively.## License
This Connect IQ barrel is licensed under the "MIT License", which essentially means that while the original author retains the copyright to the original code, you are free to do whatever you'd like with this code (or any derivative of it). See the LICENSE.txt file for complete details.## Graph Types
The following graph types are currently available:
- Line Graph (generic and 7-day weekly)More graphs will be made available as time permits. If you want/need a graph type not yet available, consider helping out. See the CONTRIBUTING.md file for details.
## Using the Barrel
This project cannot be used on it's own; it is designed to be included in existing projects.### Include the Barrel
Download the barrel file (and associated debug.xml) and include it in your project.
See [Shareable Libraries](https://developer.garmin.com/connect-iq/core-topics/shareable-libraries/) on the Connect IQ Developer site for more details.### Displaying the Graph
The graphing module contains classes that extend the ```Toybox.WatchUi.Drawable``` object, which then render the actual graph. As such, you can display graphs within your app by either adding the drawable to a layout or by creating a graph drawable object and calling the ```draw()``` function on it.Regardless of the method used to render you graph, you will still need to pass the data points (and, optionally, labels for the X-axis); see below for details on that.
#### Add Graph to a Layout
To add a graph to a layout simply include a `````` tag:
```40
100
180
100
true
0x000000
0xAAAAAA
0x00AAFF
0xFFFFFF
Graphics.FONT_SYSTEM_XTINY
@CIQToolsGraphing.LINE_STYLE_DOTTED
false```
#### Display the Graph Directly (via code)
```
var lineGraph = new CIQToolsGraphing.Line.Generic({
:identifier => "LineGraph"
:locX => 40,
:locY => 100,
:width => 180,
:height => 100,
:visible => true,
:bgColor => 0x000000,
:graphColor => 0xAAAAAA,
:pointColor => 0x00AAFF,
:textColor => 0xFFFFFF,
:textFont => Graphics.FONT_SYSTEM_XTINY,
:lineStyle => CIQToolsGraphing.LINE_STYLE_DOTTED,
:border => false
});
lineGraph.draw();
```### Adding/Updating Data for the Graph
Data for the graph must be added dynamically, by calling the ```setDataPoints()``` function on the appropriate graphic object.```
var dataPoints = [5,8,2,12,11,14,10];
var lineGraph = View.findDrawableById("LineGraph") as CIQToolsGraphing.Line.Weekly;
lineGraph.setDataPoints(dataPoints);
```## Contributing
Please see the CONTRIBUTING.md file for details on how contribute.### Contributors
* [Douglas Robertson](https://github.com/douglasr)