Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
MyCode Google Graph in Thread Help
#1
Code: Using MyCode to display a javascript google graph in a thread

Inspired by: Google Pie Chart [MyCode]

Description: I was looking through the Google Pie Chart code, and realized that it could be modified to allow for a google line graph.

With this MyCode I was trying to create a graph for a stock market role play, which could be edited by users.

What it does:
- It takes data as the Google Pie Chart MyCode does, and displays a line graph in a div.

MyCode so far:
Quote:Title: line
Regular Expression:
 \[line\](.*?),(.*?),(.*?),(.*?),(.*?),(.*?),(.*?),(.*?),(.*?),(.*?),(.*?),(.*?),(.*?),(.*?),(.*?)\[/line\]
Replacement:
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script><script type="text/javascript">function drawChart(){var a=google.visualization.arrayToDataTable([["Task","$15"],["$1",$2],["$3",$4],["$5",$6],["$7",$8],["$9",$10],["$11",$12],["$13",$14]]),b={title:"$15"},c=new google.visualization.LineChart(document.getElementById("linechart"));c.draw(a,b)}google.charts.load("current",{packages:["corechart", "line"]}),google.charts.setOnLoadCallback(drawChart);</script>
<div id="linechart" style="width: 900px; height: 500px;"></div>
Test Value:
[line]Mon,700,Tues,200,Weds,220,Thurs,230,Fri,224,Sat,224,Sun,2484,LZCP[/line]
Issues: 
- It will display in a thread but not as a new reply in that thread, even with different data.
- It isn't entirely user friendly.
- It may have security flaws of course.
- It isn't responsive yet, as I still need to play around with min/max width/height.

Result: 
   
Reply


Messages In This Thread
MyCode Google Graph in Thread Help - by New Rogernomics - 08-12-2019, 07:02 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)