简化配置:d3.chart.defaults提升d3.chart功能

需积分: 9 1 下载量 55 浏览量 更新于2024-11-04 收藏 5KB ZIP 举报
资源摘要信息:"d3.chart.defaults: d3.chart 的更简单和功能更强大的选项" d3.chart.defaults 是一个针对Miso库的JavaScript插件,它简化了在使用d3.chart创建图表时的配置过程。d3.chart是一个构建在d3.js之上的库,它提供了一种方便的方式来创建和管理复杂的交互式图表。d3.chart.defaults 插件进一步加强了这个功能,为图表的初始化提供了一种更简单、更强大的方法。 在使用d3.chart.defaults之前,需要包含以下库: - d3.js:这是d3.chart的基础,提供了强大的数据驱动文档操作的能力。 - d3.chart.js:这是d3.chart的核心库,使得创建定制图表成为可能。 - d3.chart.defaults.js:这是插件库,添加了默认配置的功能。 d3.chart.defaults 插件提供了一个应用程序接口,即d3.chart.initializeDefaults函数,它接受三个参数: - chart:一个d3.chart定义的图表实例,通常是通过调用d3.chart(...)返回的结果。 - defaults:一个对象,包含了图表的默认配置选项,键为optionName,值为optionValue。 - events:一个可选的事件对象,它将事件键值对(或由空格分隔的事件)映射到图表原型上的方法名称。如果要收集在事件回调执行之前的任何其他潜在变化,可以在这个对象中使用以“debounce:”为前缀的事件。 插件的工作原理相当简单。在创建d3.chart时,可以通过调用d3.chart.initializeDefaults来初始化图表,并传入默认的配置和事件处理。这样,图表的初始化过程就变得更为简洁,不需要在每个图表实例中重复设置相同的默认值。 例如,如果有一个名为MyChart的图表类,使用d3.chart.defaults插件初始化时,可能会这样写代码: ```javascript var MyChart = d3.chart("MyChart", { initialize: function() { // 初始化代码 }, defaults: { width: 400, height: 300, color: "#000" }, events: { "click debounce:chart": "onClick" } }); function MyChart() { d3.chart.initializeDefaults(this, { width: 400, height: 300, color: "#000" }, { "click": "onClick" }); } MyChart.prototype = d3.chart.inherit({ // MyChart的方法定义 }); ``` 在上面的示例中,MyChart类通过d3.chart创建,并通过d3.chart.initializeDefaults初始化默认值。在实例化MyChart时,会自动应用默认值,并且可以为点击事件设置防抖功能。 值得注意的是,d3.chart.defaults不仅限于简化初始配置,它还能帮助开发者管理整个图表的生命周期,包括响应数据变化、响应用户交互,以及调整图表的外观和行为。这种功能强大而又简便的初始化方法,对于开发交互式、响应式数据可视化应用来说,是非常有用的。 最后,该插件标签被标记为“JavaScript”,说明它完全使用JavaScript编写,这意味着它可以在任何支持JavaScript的环境中运行,例如在浏览器或Node.js环境中。而“d3.chart.defaults-master”则表明这是一个压缩的、包含所有必需文件的“master”版本的压缩包子文件,用户可以直接下载并使用它来扩展d3.chart的功能。

我在使用mp的分页,原先功能可以正常使用,机器重启后报了如下错误2023-06-02 14:15:54.169 ERROR --- [nio-8890-exec-5] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException: ### Error querying database. Cause: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 ### Cause: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0] with root cause java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 at java.util.ArrayList.rangeCheck(ArrayList.java:657) at java.util.ArrayList.get(ArrayList.java:433) at com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor.willDoQuery(PaginationInnerInterceptor.java:134) at com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor.intercept(MybatisPlusInterceptor.java:59) at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:61) at com.sun.proxy.$Proxy76.query(Unknown Source) at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:147) at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:140) at sun.reflect.GeneratedMethodAccessor68.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:426) at com.sun.proxy.$Proxy58.selectList(Unknown Source) at org.mybatis.spring.SqlSessionTemplate.selectList(SqlSessionTemplate.java:223) at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.executeForIPage(MybatisMapperMethod.java:122) at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.execute(MybatisMapperMethod.java:87) at com.baomidou.mybatisplus.core.override.MybatisMapperProxy$PlainMethodInvoker.invoke(Mybat

2023-06-03 上传

org.apache.ibatis.exceptions.PersistenceException: ### Error updating database. Cause: java.sql.SQLException: Column count doesn't match value count at row 1 ### The error may involve defaultParameterMap ### The error occurred while setting parameters ### SQL: insert into car value (null,'HongQi','铂光金','199800.98','4789.88') ### Cause: java.sql.SQLException: Column count doesn't match value count at row 1 at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30) at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:200) at org.apache.ibatis.session.defaults.DefaultSqlSession.insert(DefaultSqlSession.java:185) at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:57) at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:59) at com.sun.proxy.$Proxy5.insertCar(Unknown Source) at com.DJH.mybatis.test.MyBatisTest.testInsert(MyBatisTest.java:22) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.junit.runner.JUnitCore.run(JUnitCore.java:137) at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68) at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47) at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242) at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70) Caused by: java.sql.SQLException: Column count doesn't match value count at row 1 at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:129) at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122) at com.mysql.cj.jdbc.ClientPreparedStatement.executeInternal(ClientPreparedStatement.java:916) at com.mysql.cj.jdbc.ClientPreparedStatement.execute(ClientPreparedStatement.java:354) at org.apache.ibatis.executor.statement.PreparedStatementHandler.update(PreparedStatementHandler.java:46) at org.apache.ibatis.executor.statement.RoutingStatementHandler.update(RoutingStatementHandler.java:74) at org.apache.ibatis.executor.SimpleExecutor.doUpdate(SimpleExecutor.java:50) at org.apache.ibatis.executor.BaseExecutor.update(BaseExecutor.java:117) at org.apache.ibatis.executor.CachingExecutor.update(CachingExecutor.java:76) at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:198) ... 27 more

2023-07-23 上传
2023-07-21 上传

Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary. Exception in thread "main" org.apache.ibatis.exceptions.PersistenceException: ### Error querying database. Cause: java.sql.SQLNonTransientConnectionException: Public Key Retrieval is not allowed ### The error may exist in mysql/user/mappers/usermapper.xml ### The error may involve mysql.user.mappers.usermapper.selectAll ### The error occurred while executing a query ### Cause: java.sql.SQLNonTransientConnectionException: Public Key Retrieval is not allowed at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30) at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:149) at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:140) at org.apache.ibatis.binding.MapperMethod.executeForMany(MapperMethod.java:147) at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:80) at org.apache.ibatis.binding.MapperProxy$PlainMethodInvoker.invoke(MapperProxy.java:152) at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:85) at com.sun.proxy.$Proxy4.selectAll(Unknown Source) at org.example.main2.main(main2.java:25) Caused by: java.sql.SQLNonTransientConnectionException: Public Key Retrieval is not allowed at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:110) at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122) at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:829) at com.mysql.cj.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:449) at com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:242) at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:198) at java.sql.DriverManager.getConnection(Driv

2023-07-22 上传