{"id":20380369,"url":"https://github.com/gagniuc/micro-chart-in-vb","last_synced_at":"2026-03-06T09:03:51.303Z","repository":{"id":151549679,"uuid":"466557648","full_name":"Gagniuc/Micro-chart-in-VB","owner":"Gagniuc","description":"This compact chart takes into account both positive and negative values from an input. Thus, this VB chart takes into account a lower bound as well as an upper bound. The lower bound represents the lowest value whereas the upper bound represents the highest value over the input.","archived":false,"fork":false,"pushed_at":"2022-11-17T07:10:25.000Z","size":2579,"stargazers_count":4,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-04T22:25:12.788Z","etag":null,"topics":["chart","charts","micro","plot","short","simple","small","vb6","vb6-application","vb6-sample","vb6-source","vba","vba-excel"],"latest_commit_sha":null,"homepage":"","language":"Visual Basic 6.0","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Gagniuc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"Gagniuc"}},"created_at":"2022-03-05T20:11:33.000Z","updated_at":"2023-02-11T04:45:28.000Z","dependencies_parsed_at":null,"dependency_job_id":"a94b053c-d334-442d-a3ff-f0fe5f9ba9e0","html_url":"https://github.com/Gagniuc/Micro-chart-in-VB","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/Gagniuc/Micro-chart-in-VB","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Gagniuc%2FMicro-chart-in-VB","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Gagniuc%2FMicro-chart-in-VB/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Gagniuc%2FMicro-chart-in-VB/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Gagniuc%2FMicro-chart-in-VB/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Gagniuc","download_url":"https://codeload.github.com/Gagniuc/Micro-chart-in-VB/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Gagniuc%2FMicro-chart-in-VB/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30168609,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-06T07:56:45.623Z","status":"ssl_error","status_checked_at":"2026-03-06T07:55:55.621Z","response_time":250,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["chart","charts","micro","plot","short","simple","small","vb6","vb6-application","vb6-sample","vb6-source","vba","vba-excel"],"created_at":"2024-11-15T02:07:03.189Z","updated_at":"2026-03-06T09:03:51.282Z","avatar_url":"https://github.com/Gagniuc.png","language":"Visual Basic 6.0","funding_links":["https://github.com/sponsors/Gagniuc"],"categories":[],"sub_categories":[],"readme":"# Micro chart in Visual Basic\n\nThis compact chart takes into account both positive and negative values from an input. Thus, this VB chart takes into account a lower bound as well as an upper bound. The lower bound represents the lowest value whereas the upper bound represents the highest value over the input. The project in this repository shows two VB charts and both use the PictureBox object from VB6. The first one found in folder \u003ckbd\u003esrc/chart_short\u003c/kbd\u003e contains the shortest source code for a chart. Basically the implementation is represented by a function named \u003ckbd\u003echart\u003c/kbd\u003e that draws on a PictureBox object based on some consecutive numeric values. The second chart found in folder \u003ckbd\u003esrc/chart\u003c/kbd\u003e contains an addition to the first, namely it draws the \u003ckbd\u003ex-axis\u003c/kbd\u003e and \u003ckbd\u003ey-axis\u003c/kbd\u003e, and the corresponding baseline ticks. For more detailed information, note that these native charts in VB6, were published in the supplementary materials of the book entitled \u003ci\u003eAlgorithms in Bioinformatics: Theory and Implementation\u003c/i\u003e. The screenshot below shows the output of the function:\n\n![screenshot](https://github.com/Gagniuc/World-shortest-chart-in-VB6/blob/main/img/chart_short.png?raw=true)\n\nThe second chart project shows an addition to the first, namely it draws the \u003ckbd\u003ex-axis\u003c/kbd\u003e and \u003ckbd\u003ey-axis\u003c/kbd\u003e, and the corresponding baseline ticks. Also, the position of the chart can be changed inside the object with the help of four variables responsible for the vertical position, the horizontal position, the width of the chart and the height of the chart. The screenshot below shows the output of the function:\n\n![screenshot](https://github.com/Gagniuc/World-shortest-chart-in-VB6/blob/main/img/chart.png?raw=true)\n\nHow does it work? The \u003ckbd\u003echart\u003c/kbd\u003e function contains a loop that makes a number of iterations (\u003ci\u003ei\u003c/i\u003e) equal to the number of terms present in the sequence (\u003ci\u003es\u003c/i\u003e). Inside the main loop, the coordinates above the canvas object are calculated based on the maximum value, namely according to the value found in the \u003ci\u003emx\u003c/i\u003e variable. Thus, the \u003ckbd\u003ey-axis\u003c/kbd\u003e is represented by the height (\u003ci\u003eh\u003c/i\u003e) of the PictureBox object divided by the value in the \u003ci\u003emx\u003c/i\u003e variable (\u003ci\u003eh\u003c/i\u003e/\u003ci\u003emx\u003c/i\u003e), and the result is multiplied by the current value in the sequence (s[\u003ci\u003ei\u003c/i\u003e]). To position the zero values at the bottom of the chart, the \u003ckbd\u003ey-axis\u003c/kbd\u003e is reversed by subtracting the result (the \u003ci\u003ey\u003c/i\u003e value) from the height (\u003ci\u003eh\u003c/i\u003e) of the PictureBox object. However, for a better visualization, the implementation of this chart narrows the \u003ckbd\u003ey-axis\u003c/kbd\u003e and shows only the region between the two values. To obtain this relative reduction, the minimum value was taken into account, namely:\n\n\u003cimg src=\"https://github.com/Gagniuc/World-shortest-chart-in-VB6/blob/main/img/ylu.png?raw=true\" height=\"100\"\u003e\n\nIn contrast, the \u003ckbd\u003ex-axis\u003c/kbd\u003e is calculated by dividing the length of the PictureBox object by the total number of terms in the sequence (\u003cb\u003ew/s.length\u003c/b\u003e), and the\nresult is multiplied by the iteration number (\u003ci\u003ei\u003c/i\u003e):\n\n\u003cimg src=\"https://github.com/Gagniuc/World-shortest-chart-in-VB6/blob/main/img/x.png?raw=true\" height=\"100\"\u003e\n\nWhere \u003ci\u003emn\u003c/i\u003e is the minimum value and \u003ci\u003emx\u003c/i\u003e is the maximum value found over the input (the consecutive numeric values spaced by delimiters), \u003ci\u003eh\u003c/i\u003e is the PictureBox height, and s[\u003ci\u003ei\u003c/i\u003e] is the current value from the input. Note that the inner workings of the \u003ckbd\u003echart\u003c/kbd\u003e function were fully described in a [previous JS implementation](https://github.com/Gagniuc/World-smallest-js-chart-v1.0). This concludes the changes related to the \u003ckbd\u003echart\u003c/kbd\u003e function:\n\n```vb6\nFunction chart(g, c, e)\n\n    sig = Split(g, \",\")\n    \n    mx = 0\n    mn = 0\n    \n    For i = 0 To UBound(sig)\n        If (Val(sig(i)) \u003e mx) Then mx = Val(sig(i))\n        If (Val(sig(i)) \u003c mn) Then mn = Val(sig(i))\n    Next i\n\n    w = graf_val.ScaleWidth\n    h = graf_val.ScaleHeight\n\n    d = (w - 80) / (UBound(sig) - 1)\n    \n    If (e = \"|\") Then\n        graf_val.Cls\n        mxg = mx\n        mng = mn\n    End If\n    \n    graf_val.DrawWidth = 4\n    \n    For i = 0 To UBound(sig) - 1\n    \n        y = h - 15 - ((h - 15) / (mx - mn)) * (Val(sig(i)) - mn)\n        x = d * i\n\n        If (i = 0) Then\n            oldX = x\n            oldY = y\n        End If\n        \n        graf_val.Line (oldX, oldY)-(x, y), c\n        \n        oldX = x\n        oldY = y\n        \n    Next i\n \nEnd Function\n```\nAbove, \u003ckbd\u003egraf_val\u003c/kbd\u003e represents the PictureBox object over which the plot is made. The lines below show how this \u003ckbd\u003eChart\u003c/kbd\u003e function from above can be called (note that the symbol \"|\" means clear the PictureBox object before plotting the data):\n\n```vb6\nA = \"0,0.14,0.29,0.45,0.64,0.86,1.14,1.53,2.13,3.27,6.41,75.31,7.75,3.61,2.29,1.62,1.2,0.9,0.67,0.48,0.32,0.17,0.03,0.12,0.26,0.42,0.6,0.81,1.08,1.44,2,2.99,5.45,25.09,9.79,4.03,2.47,1.72,1.27,0.95,0.71,0.52,0.35,0.2,0.05,0.09,0.23,0.39,0.56,0.77,1.02,1.36,1.87,2.74,4.74,15.04,13.27,4.54,2.67,1.83,1.34\"\n\nCall chart(A, vbRed, \"|\")\n```\n\n# References\n\n- \u003ci\u003ePaul A. Gagniuc. Algorithms in Bioinformatics: Theory and Implementation. John Wiley \u0026 Sons, Hoboken, NJ, USA, 2021, ISBN: 9781119697961.\u003c/i\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgagniuc%2Fmicro-chart-in-vb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgagniuc%2Fmicro-chart-in-vb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgagniuc%2Fmicro-chart-in-vb/lists"}