Tag: jqplot

将图例名称添加到JQPlot工具提示并在工具提示中正确格式化日期

我想将绘图的图例名称添加到鼠标上方的工具提示中。 我在条形图上使用了这个jqplot工具提示的解决方案之一。 具体来说我使用了以下function: function tooltipContentEditor(str, seriesIndex, pointIndex, plot) { // display series_label, x-axis_tick, y-axis value return plot.series[seriesIndex][“label”] + “, ” + plot.data[seriesIndex][pointIndex]; } 但是,我遇到的问题是它没有使用图例名称“我的图例名称”,而是使用JQPlot默认的“系列1”或“系列5”(编号取决于系列位置)。 第二个问题是,一旦我开始使用上述function,我就会丢失日期格式。 所以我得到一个数字,例如123672378328,而不是它被转换为我在tickOptions中指定的格式。 我生成图表的代码如下: var plot; function buildChart(chartDivId, graphData, chartTitle, graphSeriesNames, labelNames) { var id = “#” + chartDivId; $(id).empty(); var seriesLine = { lineWidth:1, markerOptions: { show:false } }; plot = […]

为JqPlot条形图构造Json

我已经设法创建了一些东西来填充JqPlot饼图(非常硬编码 – 它将自动化)。 我是这样做的: public ActionResult PieChart() { return View(); } public ActionResult PieChartJSON() { List sampleData = new List(); PieChartData test = new PieChartData(); PieChartData test2 = new PieChartData(); PieChartData test3 = new PieChartData(); PieChartData test4 = new PieChartData(); PieChartData test5 = new PieChartData(); test.Label = “ta”; test.Value = 3; sampleData.Add(test); test2.Label = “be”; […]

JqPlot-如何减小网格和刻度的宽度

我正在尝试使用jqplot部署条形图。 现在如何减少网格和刻度的宽度? 我通过将showGridline设置为false来删除网格线,但它仍然垂直显示。 我的屏幕。 我希望x轴刻度看起来像这样。 我的js代码。 $(document).ready(function () { var s1 = [10, 20, 30, 40]; // Can specify a custom tick Array. // Ticks should match up one for each y value (category) in the series. var ticks = [1, 2, 3, 4]; var plot1 = $.jqplot(‘chart1’, [s1], { // The “seriesDefaults” option is […]

使用getJson()将Json字符串传递给JQuery

对于JSON和jQuery都是新手,但这是我想要做的 – 我将JSON字符串作为更大的报表模型的一部分返回到我的网页,以便同时创建多个图表(使用jqPlot )生成报告。 为了练习这些图表,我使用了以下教程 – 教程 这是本教程的jQuery – jQuery(document).ready(function() { urlDataJSON = ‘/Graph/HearthRateDataJSON’; $.getJSON(urlDataJSON, “”, function(data) { var dataLines = []; var dataLabels = “”; $.each(data, function(entryindex, entry) { dataLines.push(entry[‘Serie’]); dataLabels = dataLabels + entry[‘Name’]; }); Plot(dataLines, dataLabels); }); }); function Plot(dataLines, dataLabels) { var line1 = “{ label: ‘line1.0’ }”; options = { […]

jqplot不适用于动态数据

我正在尝试使用jqplot绘制从SQLite DB for Phonegap检索数据的条形图 – Android如何对db值使用相同的代码。 这个带有静态数据的代码在标签内工作正常,但是当我试图把这个代码放在$(‘#pageid’).live(‘pageinit’,function(){}); 然后它不起作用。 什么原因? var s1 = [10,0,0,0,0]; var s2 = [0,20,0,0,0]; var s3 = [0,0,30,0,0]; var s4 = [0,0,0,25,0]; var s5 = [0,0,0,0,0]; var ticks = [‘FAJR’, ‘ZOHAR’, ‘ASR’, ‘MAGHRIB’,’ISHA’]; var plot1 = $.jqplot(‘chart1’, [s1, s2, s3,s4,s5], { // The “seriesDefaults” option is an options object that will // […]

Jqplot中两个系列数据的变色条

我想知道如何在Jqplot中制作两个系列的变色条。 如果我只有一个系列数据,它的工作方式与下图完全相同 红色和绿色基于其价值。 但是如果我有两个系列数据,我就无法为每个系列数据配置两个系列颜色。 到目前为止,我只能制作这张图 我希望这两个系列图可以根据其值以及一个系列图来改变颜色。 这是我的代码 chart = $.jqplot(‘map-chart’, [dataChart, dataChart2], { title: ‘TIME’, legend: { renderer: $.jqplot.EnhancedLegendRenderer, show: true, location: ‘ne’ }, series: [{label: ‘Current data’}, {label: ‘Worst data’}], //seriesColors: seriesColors1, seriesDefaults:{ renderer:$.jqplot.BarRenderer, pointLabels: {show: true} //rendererOptions:{ //varyBarColor: true //} }, axes: { xaxis: { label: ‘station’, renderer: $.jqplot.CategoryAxisRenderer, labelRenderer: $.jqplot.CanvasAxisLabelRenderer, tickRenderer: $.jqplot.CanvasAxisTickRenderer, […]

jQPlot强制y轴上的静态最小值和最大值

我正在使用jqPlot来渲染条形图,我希望做一些相当简单的事情,但我不确定图书馆是否有这个选项。 我有这样的图形,其中y轴上的最大可能值可以是42。 假设对于一个案例,我对任何一个柱的最高值是14,那么图形将呈现为最多只显示14个。 但是,我想要这样,在所有情况下,我可以看到42的上限呈现。 这就是我现在所拥有的: var plot3 = $.jqplot(‘chart3’, [line1], { animate: true, animateReplot: true, seriesDefaults: {renderer: $.jqplot.BarRenderer}, series:[{ pointLabels:{ show: true, labels:[depression, anxiety, stress] }, rendererOptions: { animation: { speed: 3500 }, barWidth: 50, barPadding: -15, barMargin: 0, varyBarColor : true, highlightMouseOver: false } }], axes: { xaxis: { renderer:$.jqplot.CategoryAxisRenderer } }, canvasOverlay: { […]

jqPlot Chart使用asp.net MVC,JSON

我是MVC和jQuery以及jqPlot的新手。 任何人都可以举例说明我可以找到演示项目或逐步程序来实现。 我需要的是: 如何返回JSON进行查看。 添加View时 – 它应该是部分视图还是普通视图? 如何使用jQuery从视图中获取JSON。 如何在jqPlot中传递JSON对象? 非常感谢提前。 =============================================== 尝试下面的代码,它总是去ERROR部分,谁能解释是什么原因? $(document).ready(function () { $(“#btnClick”).click(function () { alert(‘Inside Click Function’); $.ajax( type: ‘GET’, url: “JSONSample.aspx/GetItSerialized”, processData: true, data: {}, contentType: “application/json; charset=utf-8”, dataType: “json”, success: function (data) { $.each(data.d, function (index, item) { alert(‘Inside Success’); }); //alert(‘Inside Success’); //processData(data); }, error: function(jqXHR, textStatus, errorThrown) […]

如何在jqplot图中显示单个标记

嗨我正在使用jqplot图。 我需要隐藏当前显示在绘图表上的圆形点,除了最后一个点之外,数组中的每个值都是如此。 我使用以下代码显示图表。 我使用了“show marker:false”选项,但它隐藏了图中的所有圆形。 请帮我如何在图表中只显示一个圆点。 var line2 = [[‘2012-10-02’, 20],[‘2012-10-03’, 45],[‘2012-10-04’, 35],[‘2012-10-05’, 32],[‘2012-10-06’, 30],[‘2012-10-07’, 25]]; var plot1 = $.jqplot(‘chart2’, [line2], { seriesDefaults: { showMarker: false }, axes:{ xaxis:{ renderer:$.jqplot.DateAxisRenderer, labelRenderer: $.jqplot.CanvasAxisLabelRenderer, tickRenderer: $.jqplot.CanvasAxisTickRenderer, tickOptions: { angle: -90, formatString: ‘%m/%d/%Y’ }, } }, yaxis: { labelRenderer: $.jqplot.CanvasAxisLabelRenderer }, highlighter: { show: true }, cursor: { […]

jqplot:“this.proxy.getTime不是函数”/日期输入解析器?

我尝试使用jqplot绘制图形。 所以我修改了这个例子以获得基于日期的图表。 目前我的代码是这样的: var plot1 = $.jqplot(‘chartdiv’, [[[“2010-12-25.14:19:47”,1], [“2010-11-25.14:19:47”,2], [“2010-10-25.14:19:47”,3]]], { title: ‘mytitle’, series: [{ label: ‘my label’, neighborThreshold: -1 }], axes: { xaxis: { renderer: $.jqplot.DateAxisRenderer, // min:’August 1, 2010 16:00:00′, tickInterval: ‘1 months’, tickOptions:{formatString:’%Y-%m-%d.%H:%M:%S’} }, yaxis: { tickOptions:{formatString:’$%.2f’} } }, cursor:{ show: true, zoom:true, showTooltip:false } }); 但是我收到以下错误: this.proxy.getTime is not a function […]