我可以将JS变量用于charts.js值吗?

时间:2016-04-13 00:52:58

标签: javascript chart.js

我正在使用charts.js并在下面有类似的内容

     --> Wrapper Started as Console
Launching a JVM...
Wrapper (Version 3.2.3) http://wrapper.tanukisoftware.org
  Copyright 1999-2006 Tanuki Software, Inc.  All Rights Reserved.

2016.04.13 02:30:01 INFO  app[o.s.a.AppFileSystem] Cleaning or creating temp directory /usr/local/Cellar/sonar/5.4/libexec/temp
2016.04.13 02:30:01 INFO  app[o.s.p.m.JavaProcessLauncher] Launch process[search]: /Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home/jre/bin/java -Djava.awt.headless=true -Xmx1G -Xms256m -Xss256k -Djava.net.preferIPv4Stack=true -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+HeapDumpOnOutOfMemoryError -Djava.io.tmpdir=/usr/local/Cellar/sonar/5.4/libexec/temp -cp ./lib/common/*:./lib/search/* org.sonar.search.SearchServer /var/folders/zb/hstkh53d32d1yqxmyhbjrg3c0000gq/T/sq-process7171255290909270089properties
2016.04.13 02:30:02 INFO   es[o.s.p.ProcessEntryPoint]  Starting search
2016.04.13 02:30:02 INFO   es[o.s.s.SearchSettings]  Elasticsearch listening on 127.0.0.1:9001
log4j:WARN No appenders could be found for logger (org.elasticsearch.node).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
2016.04.13 02:30:07 INFO  app[o.s.p.m.Monitor] Process[search] is up
2016.04.13 02:30:07 INFO  app[o.s.p.m.JavaProcessLauncher] Launch process[web]: /Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home/jre/bin/java -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djruby.management.enabled=false -Djruby.compile.invokedynamic=false -Xmx768m -Xms256m -XX:MaxPermSize=160m -XX:+HeapDumpOnOutOfMemoryError -Djava.net.preferIPv4Stack=true -Djava.io.tmpdir=/usr/local/Cellar/sonar/5.4/libexec/temp -cp ./lib/common/*:./lib/server/*:/usr/local/Cellar/sonar/5.4/libexec/lib/jdbc/h2/h2-1.3.176.jar org.sonar.server.app.WebServer /var/folders/zb/hstkh53d32d1yqxmyhbjrg3c0000gq/T/sq-process8184838493579271569properties
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=160m; support was removed in 8.0
2016.04.13 02:30:07 INFO  web[o.s.p.ProcessEntryPoint] Starting web
2016.04.13 02:30:07 INFO  web[o.s.s.a.TomcatContexts] Webapp directory: /usr/local/Cellar/sonar/5.4/libexec/web
2016.04.13 02:30:08 INFO  web[o.a.c.h.Http11NioProtocol] Initializing ProtocolHandler ["http-nio-0.0.0.0-9000"]
2016.04.13 02:30:08 INFO  web[o.a.t.u.n.NioSelectorPool] Using a shared selector for servlet write/read
2016.04.13 02:30:08 INFO  web[o.s.s.p.ServerImpl] SonarQube Server / 5.4 / 7b02df9be3cd9448699b5857586e1c6e2b28c007
2016.04.13 02:30:08 INFO  web[o.s.s.d.EmbeddedDatabase] Starting embedded database on port 9092 with url jdbc:h2:tcp://localhost:9092/sonar
2016.04.13 02:30:08 INFO  web[o.s.s.d.EmbeddedDatabase] Embedded database started. Data stored in: /usr/local/Cellar/sonar/5.4/libexec/data
2016.04.13 02:30:08 INFO  web[o.sonar.db.Database] Create JDBC data source for jdbc:h2:tcp://localhost:9092/sonar
2016.04.13 02:30:08 WARN  web[o.s.d.DatabaseChecker] H2 database should be used for evaluation purpose only
2016.04.13 02:30:09 INFO  web[o.e.plugins] [sonar-1460507401119] loaded [], sites []
2016.04.13 02:30:10 INFO  web[o.s.s.p.DefaultServerFileSystem] SonarQube home: /usr/local/Cellar/sonar/5.4/libexec
2016.04.13 02:30:11 INFO  web[o.s.s.p.ServerPluginRepository] Plugin C# [csharp] installed
2016.04.13 02:30:11 INFO  web[o.s.s.p.ServerPluginRepository] Plugin Java [java] installed
2016.04.13 02:30:11 INFO  web[o.s.s.p.ServerPluginRepository] Plugin JavaScript [javascript] installed
2016.04.13 02:30:11 INFO  web[o.s.s.p.ServerPluginRepository] Plugin Git [scmgit] installed
2016.04.13 02:30:11 INFO  web[o.s.s.p.ServerPluginRepository] Plugin SVN [scmsvn] installed
2016.04.13 02:30:11 INFO  web[o.s.s.p.ServerPluginRepository] Deploy plugin C# / 4.4 / 5b9adce1c37c4ef907b316ea4500ed5d7c4629c4
2016.04.13 02:30:11 INFO  web[o.s.s.p.ServerPluginRepository] Deploy plugin Git / 1.0 / 9ce9d330c313c296fab051317cc5ad4b26319e07
2016.04.13 02:30:11 INFO  web[o.s.s.p.ServerPluginRepository] Deploy plugin Java / 3.10 / e55d43e814fd68587a7a9e0f37089492b34445cc
2016.04.13 02:30:11 INFO  web[o.s.s.p.ServerPluginRepository] Deploy plugin JavaScript / 2.10 / 88475229068f817583013a08facf2b45d0357829
2016.04.13 02:30:11 INFO  web[o.s.s.p.ServerPluginRepository] Deploy plugin SVN / 1.2 / d04c3cdb21f48905dd8300d1129ec90281aa6db2
2016.04.13 02:30:11 INFO  web[o.s.s.d.m.DatabaseMigrator] Create database
2016.04.13 02:30:11 INFO  web[o.s.s.p.RailsAppsDeployer] Deploying Ruby on Rails applications
2016.04.13 02:30:12 INFO  web[o.s.s.p.UpdateCenterClient] Update center: http://update.sonarsource.org/update-center.properties (no proxy)
2016.04.13 02:30:12 INFO  web[o.s.s.e.IndexCreator] Create index tests
2016.04.13 02:30:12 INFO  web[o.s.s.e.IndexCreator] Create type tests/test
2016.04.13 02:30:12 INFO  web[o.s.s.e.IndexCreator] Create index activities
2016.04.13 02:30:13 INFO  web[o.s.s.e.IndexCreator] Create type activities/activity
2016.04.13 02:30:13 INFO  web[o.s.s.e.IndexCreator] Create index issues
2016.04.13 02:30:13 INFO  web[o.s.s.e.IndexCreator] Create type issues/authorization
2016.04.13 02:30:13 INFO  web[o.s.s.e.IndexCreator] Create type issues/issue
2016.04.13 02:30:13 INFO  web[o.s.s.e.IndexCreator] Create index users
2016.04.13 02:30:13 INFO  web[o.s.s.e.IndexCreator] Create type users/user
2016.04.13 02:30:13 INFO  web[o.s.s.e.IndexCreator] Create index views
2016.04.13 02:30:13 INFO  web[o.s.s.e.IndexCreator] Create type views/view
2016.04.13 02:30:13 INFO  web[o.s.s.n.NotificationService] Notification service started (delay 60 sec.)
2016.04.13 02:30:13 INFO  web[o.s.s.s.IndexSynchronizer] Index rules
2016.04.13 02:30:13 INFO  web[o.s.s.s.IndexSynchronizer] Index activeRules
2016.04.13 02:30:13 INFO  web[o.s.s.s.RegisterMetrics] Register metrics
2016.04.13 02:30:14 INFO  web[o.s.s.s.RegisterDebtModel] Register technical debt model
2016.04.13 02:30:14 INFO  web[o.s.s.r.RegisterRules] Register rules
2016.04.13 02:30:22 INFO  web[o.s.s.q.RegisterQualityProfiles] Register quality profiles
2016.04.13 02:30:23 INFO  web[o.s.s.q.RegisterQualityProfiles] Register profile {lang=cs, name=Sonar way}
2016.04.13 02:30:24 INFO  web[o.s.s.q.RegisterQualityProfiles] Set default cs profile: Sonar way
2016.04.13 02:30:24 INFO  web[o.s.s.q.RegisterQualityProfiles] Register profile {lang=java, name=Sonar way}
2016.04.13 02:30:25 INFO  web[o.s.s.q.RegisterQualityProfiles] Set default java profile: Sonar way
2016.04.13 02:30:25 INFO  web[o.s.s.q.RegisterQualityProfiles] Register profile {lang=js, name=Sonar way}
2016.04.13 02:30:26 INFO  web[o.s.s.q.RegisterQualityProfiles] Register profile {lang=js, name=Sonar Security Way}
2016.04.13 02:30:26 INFO  web[o.s.s.q.RegisterQualityProfiles] Set default js profile: Sonar way
2016.04.13 02:30:26 INFO  web[o.s.s.s.RegisterNewMeasureFilters] Register measure filters
2016.04.13 02:30:26 INFO  web[o.s.s.s.RegisterNewMeasureFilters] Register measure filter: Projects
2016.04.13 02:30:26 INFO  web[o.s.s.s.RegisterNewMeasureFilters] Register measure filter: My favourites
2016.04.13 02:30:26 INFO  web[o.s.s.s.RegisterDashboards] Register dashboards
2016.04.13 02:30:26 INFO  web[o.s.s.s.RegisterDashboards] Register dashboard: Custom
2016.04.13 02:30:26 INFO  web[o.s.s.s.RegisterDashboards] Register dashboard: Home
2016.04.13 02:30:26 INFO  web[o.s.s.s.RegisterPermissionTemplates] Register permission templates
2016.04.13 02:30:26 INFO  web[o.s.s.s.RenameDeprecatedPropertyKeys] Rename deprecated property keys
2016.04.13 02:30:26 INFO  web[o.s.s.s.RenameIssueWidgets] Replacing issue related widgets with issue filter widgets
2016.04.13 02:30:27 INFO  web[o.s.s.s.IndexSynchronizer] Index activities
2016.04.13 02:30:27 INFO  web[o.s.s.s.IndexSynchronizer] Index issues
2016.04.13 02:30:27 INFO  web[o.s.s.s.IndexSynchronizer] Index tests
2016.04.13 02:30:27 INFO  web[o.s.s.s.IndexSynchronizer] Index users
2016.04.13 02:30:27 INFO  web[o.s.s.s.IndexSynchronizer] Index views
2016.04.13 02:30:27 INFO  web[o.s.s.c.q.PurgeCeActivities] Delete the Compute Engine tasks created before Fri Oct 16 02:30:27 CEST 2015
2016.04.13 02:30:28 INFO  web[jruby.rack] jruby 1.7.9 (ruby-1.8.7p370) 2013-12-06 87b108a on Java HotSpot(TM) 64-Bit Server VM 1.8.0_65-b17 [darwin-x86_64]
2016.04.13 02:30:28 INFO  web[jruby.rack] using a shared (threadsafe!) runtime
2016.04.13 02:30:36 INFO  web[jruby.rack] keeping custom (config.logger) Rails logger instance
2016.04.13 02:30:36 INFO  web[o.s.s.p.MasterServletFilter] Initializing servlet filter org.sonar.server.authentication.InitFilter@904e9a6 [pattern=/sessions/init/*]
2016.04.13 02:30:36 INFO  web[o.s.s.p.MasterServletFilter] Initializing servlet filter org.sonar.server.authentication.OAuth2CallbackFilter@73903d0f [pattern=/oauth2/callback/*]
2016.04.13 02:30:36 INFO  web[o.a.c.h.Http11NioProtocol] Starting ProtocolHandler ["http-nio-0.0.0.0-9000"]
2016.04.13 02:30:36 INFO  web[o.s.s.a.TomcatAccessLog] Web server is started
2016.04.13 02:30:36 INFO  web[o.s.s.a.EmbeddedTomcat] HTTP connector enabled on port 9000
2016.04.13 02:30:37 INFO  app[o.s.p.m.Monitor] Process[web] is up
2016.04.13 02:31:22 INFO  web[o.s.s.c.t.CeWorkerCallableImpl] Execute task | project=my:project | id=AVQNB5aeBQmoeuaHE_RF
2016.04.13 02:31:22 ERROR web[o.s.s.c.t.CeProcessingSchedulerImpl] Compute Engine execution failed. Scheduled processing interrupted.
java.lang.NoSuchMethodError: org.apache.log4j.MDC.put(Ljava/lang/String;Ljava/lang/String;)V
    at org.sonar.server.computation.log.CeLogging.initForTask(CeLogging.java:107) ~[sonar-server-5.4.jar:na]
    at org.sonar.server.computation.taskprocessor.CeWorkerCallableImpl.executeTask(CeWorkerCallableImpl.java:71) ~[sonar-server-5.4.jar:na]
    at org.sonar.server.computation.taskprocessor.CeWorkerCallableImpl.call(CeWorkerCallableImpl.java:55) ~[sonar-server-5.4.jar:na]
    at org.sonar.server.computation.taskprocessor.CeWorkerCallableImpl.call(CeWorkerCallableImpl.java:34) ~[sonar-server-5.4.jar:na]
    at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_65]
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_65]
    at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_65]
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) [na:1.8.0_65]
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) [na:1.8.0_65]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_65]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_65]
    at java.lang.Thread.run(Thread.java:745) [na:1.8.0_65]     

它显示甜甜圈图表罚款。

现在,假设我有一个像这样的JS变量......

var doughnutData = [
                   {
                      value: 40,
                      label: 'My Caption',
                      color: '#811BD6'
                   },{
                  value: 20,
                  label: 'cap 2',
                  color: '#D18177'
               },
               {
                  value : 40,
                  label: 'cap 3',
                  color: '#6AE128'
               },
];

我想使用那个变量而不是显式的“40”,所以像这样......

var somevar = 40;

这显然打破了一切,因为图表根本不显示。是否可以在charts.js中使用“值”变量?

0 个答案:

没有答案