我想在Excel工作表中创建PieChart,我为此使用了以下代码:
import morgan from 'morgan'
import { mergeSchemas } from 'graphql-tools'
import { ApolloServer } from 'apollo-server-express'
import assessmentSchema from './assessment/schema'
import AssessmentAPI from './assessment/dataSource'
import userSchema from './user/schema'
import UserAPI from './user/dataSource'
/**
* Installs apollo-server to handle requests under `path`
* @param {*} app Express instance
* @param {*} path route path, like '/graphql'
*/
export const createApi = (app, path) => {
const dataSources = () => ({
assessmentAPI: new AssessmentAPI({ store: 'intentionally undefined' }),
userAPI: new UserAPI()
})
const schema = mergeSchemas({
schemas: [assessmentSchema, userSchema]
})
morgan.token('graphql-query', req => {
const { operationName } = req.body
return `GRAPHQL: Operation Name: ${operationName}`
})
// TODO: Add custom logging middleware for GraphQL queries/mutations
// The next line would add middleware to all of express, but I only want this style of logging for graphQL
/*** Question is about the following line ***/
// app.use(morgan(':graphql-query'))
const apolloServer = new ApolloServer({ schema, dataSources })
apolloServer.applyMiddleware({ app, path })
}
但是绘图区总是空的,就像在照片中一样,图表所需的数据用灰色阴影显示。