| |

VerySource

 Forgot password?
 Register
Search
View: 774|Reply: 4

How to display the data displayed by the DataGrid as a histogram?

[Copy link]

1

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-3-19 18:00:02
| Show all posts |Read mode
How to display the data displayed by the DataGrid as a histogram?

For example: DataGrid has three columns
=====================================
Project name Module name Completion time
------------------------------------------
A project login module 2 hours
A project registration module 3 hours
Project B Query module 1 hour
Project B Statistics module 4 hours
======================

The histogram to be achieved is:

Item A is shown as a column of 2 + 3 = 5
There are small pillars with login module 2 and small pillars with registration module 3
Item B is shown as a 1 + 4 = 5 column
There are small pillars with a query module of 1 and a small pillar with a statistics module of 4.
All columns are on the same horizontal line, preferably with different colors

I am currently working on it and have not fully implemented it. I have not found a suitable chart control on the Internet.
If any heroes are more familiar with icon display data technology, please give pointers. Thank you.
Reply

Use magic Report

0

Threads

322

Posts

115.00

Credits

Newbie

Rank: 1

Credits
115.00

 China

Post time: 2020-6-24 18:15:01
| Show all posts
Use owc control.
Reply

Use magic Report

0

Threads

322

Posts

115.00

Credits

Newbie

Rank: 1

Credits
115.00

 China

Post time: 2020-6-24 20:30:01
| Show all posts
private void DrawChart()
{
// Place user code here to initialize the page
//Create a ChartSpace object to place the chart
OWC.ChartSpace objCSpace = new OWC.ChartSpaceClass ();

//Add a chart to the ChartSpace object, and the Add method returns the chart object
OWC.WCChart objChart = objCSpace.Charts.Add(0);

//Specify the type of chart. The type is obtained from the OWC.ChartChartTypeEnum enumeration value
objChart.Type = OWC.ChartChartTypeEnum.chChartTypeColumnClustered;

//Specify whether the chart needs a legend
objChart.HasLegend = true;

//Given title
objChart.HasTitle = true;
objChart.Title.Caption = "First half distribution map";

//The illustration of the given x,y axis
objChart.Axes[0].HasTitle = true;
objChart.Axes[0].Title.Caption = "Y: quantity";
objChart.Axes[1].HasTitle = true;
objChart.Axes[1].Title.Caption = "X: month";

                        //calculate data
/*categories and values ​​can be represented by tab-separated strings*/
string strSeriesName = "Legend 1";
string strCategory = "1" + '\t' + "2" + '\t' + "3" + '\t'+"4" + '\t' + "5" + '\t' + "6" + '\t' ;
string strValue = "9" + '\t' + "8" + '\t' + "4" + '\t'+"10" + '\t' + "12" + '\t' + "6" + '\t' ;

//Add a series
objChart.SeriesCollection.Add(0);

//The name of the given series
objChart.SeriesCollection[0].SetData (OWC.ChartDimensionsEnum.chDimSeriesNames,
+ (int)OWC.ChartSpecialDataSourcesEnum.chDataLiteral, strSeriesName);

//Given classification
objChart.SeriesCollection[0].SetData (OWC.ChartDimensionsEnum.chDimCategories,
+ (int)OWC.ChartSpecialDataSourcesEnum.chDataLiteral, strCategory);

                        //Desired point
objChart.SeriesCollection[0].SetData
(OWC.ChartDimensionsEnum.chDimValues,
(int)OWC.ChartSpecialDataSourcesEnum.chDataLiteral, strValue);
//The relative path of the GIF file.
string strRelativePath = "./test.gif";
//Output to GIF file.
string strAbsolutePath = Server.MapPath(strRelativePath);
objCSpace.ExportPicture(strAbsolutePath, "GIF", 600, 350);


//Add the picture to the placeholder.
string strImageTag = "<IMG SRC='" + strRelativePath + "'/>";
ChartHolder.Controls.Add(new LiteralControl(strImageTag));

}
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-6-28 22:45:01
| Show all posts
Refer to the upstairs, use OWC, installed OFFICE
Reply

Use magic Report

1

Threads

60

Posts

37.00

Credits

Newbie

Rank: 1

Credits
37.00

 China

Post time: 2020-7-13 12:30:01
| Show all posts
Using ZedGraph can also realize the segmented graph in the column mounting diagram
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list