对齐多个DotNet.HighCharts [英] Alignment multiple DotNet.HighCharts

查看:367
本文介绍了对齐多个DotNet.HighCharts的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

看来,Render方法不DotNet.HighCharts支持,这使得它很难对齐多个图表在同一个页面。
我能够填充在同一页上多个图表,但我不能够下一个对齐它们彼此。然而,他们将后彼此被显示。有没有人有一个想法如何显示相邻的两个图表?甚至4图表作为一个块?

It seems that the Render method is not supported in DotNet.HighCharts which makes it hard to align multiple charts in the same page. I am able to populate multiple charts on the same page, but I am not able to align them next to each other. However they will be displayed after each other. Does anyone has an idea how to display 2 charts next to each other? or even 4 charts as a block?

请注意:我使用ASP.Net MVC3

Note: I am using ASP.Net Mvc3.

推荐答案

为什么不创建一个组,将举行每一个图表DIV容器的DIV。
随着布局决定(并排或任何一面)。然后在每个排行榜发送给你想要的主人的容器?

Why not create a sets of DIVs that will hold one chart DIV container each. With a layout you decide (side by side or whatever). And then send each chart to the "master" container you want?

下面是一些psuedo- code,因为我不是太熟悉MVC。

Here is some psuedo-code since I am not too familiar with MVC.

创建一个表或在您的显示页面(ASPX等)可寻址元素其他一些结构化的容器中。然后里面的这些元素(例如,表格单元格)中的一个单独添加的文字标记为每个图表。在codebehind创造什么一系列图表中你个人的图表来代替。
因此,像:

Create a table or some other structured container with addressable elements in your display page (aspx, etc). Then add your literal tag for each chart separately inside one of these elements (ie, a table cell). In the codebehind create your individual charts instead of what series of charts. So something like:

<table>
<cell1>
<asp:literal id="ltrchart1">
</cell1>
<cell2>
<asp:literal id="ltrchart2">
</cell2>
<cell3>
<asp:literal id="ltrchart3">
</cell3>
<cell4>
<asp:literal id="ltrchart4">
</cell4>
</table>

然后在你的codebehind做这样的事情:

Then in your codebehind do something like:

chart1 as new highcharts("chart1").....
ltrchart1.Text = chart1.ToHtmlString()

chart2 as new highcharts("chart2").....
ltrchart2.Text = chart2.ToHtmlString()

chart3 as new highcharts("chart3").....
ltrchart3.Text = chart3.ToHtmlString()

chart4 as new highcharts("chart4").....
ltrchart4.Text = chart4.ToHtmlString()

这是不是pretty但它能够完成任务。

This is not pretty but it gets the job done.

这篇关于对齐多个DotNet.HighCharts的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆