Coder Social home page Coder Social logo

contabs's Introduction

contabs's People

Contributors

chandler-davidson avatar iklen5 avatar kukkimonsuta avatar mikestedman avatar ravikc avatar royhoey avatar tdwright avatar watfordgnf avatar zumo-sk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

contabs's Issues

Need a snazzy logo

ConTabs looks a bit drab in NuGet. Can we sauce it up with a snazzy logo?

Add an option to plot simple bar charts in a generated column

For numeric columns, it would be cool to be able to visualize these as a simple bar chart in a new column.

For instance:

โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚         โ”‚        โ”‚                                                            โ”‚
โ”‚ Name    โ”‚ Radius โ”‚ Radius chart                                               โ”‚
โ”‚         โ”‚        โ”‚                                                            โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚         โ”‚        โ”‚                                                            โ”‚
โ”‚ Mercury โ”‚ 2439   โ”‚ ##                                                         โ”‚
โ”‚         โ”‚        โ”‚                                                            โ”‚
โ”‚ Venus   โ”‚ 6052   โ”‚ #####                                                      โ”‚
โ”‚         โ”‚        โ”‚                                                            โ”‚
โ”‚ Earth   โ”‚ 6371   โ”‚ #####                                                      โ”‚
โ”‚         โ”‚        โ”‚                                                            โ”‚
โ”‚ Mars    โ”‚ 3389   โ”‚ ##                                                         โ”‚
โ”‚         โ”‚        โ”‚                                                            โ”‚
โ”‚ Jupiter โ”‚ 69911  โ”‚ ########################################################## โ”‚
โ”‚         โ”‚        โ”‚                                                            โ”‚
โ”‚ Saturn  โ”‚ 58232  โ”‚ ################################################           โ”‚
โ”‚         โ”‚        โ”‚                                                            โ”‚
โ”‚ Uranus  โ”‚ 25362  โ”‚ #####################                                      โ”‚
โ”‚         โ”‚        โ”‚                                                            โ”‚
โ”‚ Neptune โ”‚ 24622  โ”‚ ####################                                       โ”‚
โ”‚         โ”‚        โ”‚                                                            โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

This gives a nice quick visual representation of the data in the column. The above example can be achieved with existing functionality by doing something like:

table.Columns.AddGeneratedColumn<int, string>(
	d => {
		var normalized = d / 2400;
		return new string('#', normalized);
	},
	"Radius chart",
	table.Columns["Diameter"]
);

But, since the scope of the lambda here is limited to data from individual rows, we have no way of automagically scaling the chart to an appropriate scale. In the above example, I've hard coded the fact that each unit of width of the bars corresponds to 2400km, but this is not ideal.

In a proper implementation, there would be a quick way of adding a chart column that didn't need the lambda writing out, nor any prior knowledge of the correct scale.

In terms of API design, I imagine users would want the ability to:

  1. override scale
  2. set the bar character
  3. define overall width.

NB: 1 and 3 may not be compatible - what's the most intuitive way of handling this?

Build in alternative table styles

Rather than hypens, pipes and pluses, we should be able to switch to other "themes" for tables.

The default might looks like this:

+-------+--------+
| Apple | Orange |
+-------+--------+
| 12    | ABC    |
| 123   | AB     |
+-------+--------+

And we may want (for instance) to be able to use hashes and equals signs:

#=======#========#
# Apple # Orange #
#=======#========#
# 12    # ABC    #
# 123   # AB     #
#=======#========#

Wiki: Two small edits

Hi @tdwright,

I was just going though the process of setup and trying to get a familiarity with contabs before I start work on Issue 54. I noticed two potential errors/typos in the wiki pages.

I tried to edit them myself and submit a change request, but it's not obvious how github lets you fork wiki pages since they aren't part of the repo itself. After a bit of searching on stack overflow, I not sure it's even possible in any easy way. Weird. If you do know how to do that easily, I'd be happy to know for the future.

Anyways, I thought I'd just list the two things I found as an issue:
First, on page 2, styling, I believe the correct order for the three symbols in custom styles should be wall, floor, corner not floor, wall, corner.
Second, on page 6, generating columns, after the example in "Basic usage" on step 2 it says input twice. I believe this should say "input type is float and the output type is int".

Hope that's helpful, let me know if I'm misunderstanding.

Best,
Maxwell

Allow cell padding to be changed

The default cell padding is one character left and right. This can look cramped for some data sets.

Can we add a table-level property to allow the padding on the left and right side of the heading/data to be set?

I would imagine we would keep the padding symmetrical and apply one value to all columns.

I think at this stage we would ignore vertical spacing between rows, although this could be addressed in a separate issue.

Unit tests failing on locales with different decimal separator

20 unit tests are failing when using comma as a decimal separator in system locale, for example test CurrencyFieldCanBeFormatted fails with:

val should be "ยฃ1.91" but was "ยฃ1,91"

The tests should be rewritten to be compatible with different locales (for example, using CurrentCulture.NumberFormat.NumberDecimalSeparator, or switching to different locale before testing), or columns should have support for CultureInfo in addition to string formatting.

I'd be happy to help with this issue if you decide which way you would like to have this fixed.

Add derived computed columns

Possibly by using delegates?

E.g. turning a date and end date into days relative to today, or multiplying a rate by a quantity to get a subtotal.

Should we allow for the localisation culture to be specified?

Following on from #55, do we ever want to be able to explicitly specify the formatting culture a table (or column) should use when rendering values?

Approaches:

  1. Apply whatever localisation settings are provided by the system (current behaviour)
  2. Override the culture for the whole thread (a la CultureInfo.CurrentCulture, though not sure this works in .NET Core?)
  3. Allow a culture to be specified at the table level, which would be passed down to the formatters for each column
  4. Allow a culture to be specified on a per-column basis.

Keen to get some feedback on this. Anyone got any thoughts?

Print transpose of a table

Currently a class fields printed as columns, I like to print them as rows, any idea how to do that. # @

Enhancement: Use Data annotations for customizing output.

Using contabs I find myself forced mapping some POCO to some smaller object which only contains a subset of the properties - those I want to show in console.

It would be so much DRYer if I could just use the original POCO.
Thus I would require some way to specify which properties to print and which not.

A common library face with a similiar issue uses data annotation:
https://www.newtonsoft.com/json/help/html/SerializationAttributes.htm

Here an object can be declared "OptIn" and only those properties with such an "OptIn" annotation will actually be serialized.

Transferred to contabs such may look like:

[ConTabsObject(MemberInclusion.OptIn)]
public class MyPoco {

    [ConTabsProperty] // will be included
    public string PrintMe { get; set; }

     // not opted-in:  will not show up in table
    public string HideMe { get; set; }

    ...

}

Of course the such annotations could be used for other purposes as well, like string formatting or column alignment - essentially every option the current configuration offers

Enhancement: New style - Empty

AFAIK - there is no style which uses just (space) as the delimiter.
I feel such style, which is the most minimal style possible, is painfully missing from the defaults.
It is great to enhance readability of the data printed.

Ability to change column header text

Currently the title of each column is taken from the name of the underlying field.

There may be times when the underlying field has a very long, or unfriendly name. In these cases we may want to change the column header to some other string that we specify.

(NB: How does this interact with #24?)

Shouldn't be possible to make a table if there aren't any valid columns

Currently if you try to make a table from a class without any public properties, you get a wonky table without any headers or content, although the correct numbers of (empty) rows do get printed.

When creating a table, we should check to see how many valid columns are present. The either throw an exception, or handle the "no column" case like we do the "no data" case.

Related: what happens if there are valid columns, but they're all set to "hide"?

Add demo app for .NET 5

.NET 5 was released on XXX and signifies the reunification of the .NET landscape.

Contabs was born at a time when .NET Standard was new(ish) and was in some ways a showcase of writing modern, portable, multi-platform C# code.

Since .NET 5 doesn't replace .NET Standard, I won't be changing witch TFM is targetted by Contabs itself. I will, however, create a demo app that shows that it can be consumed (as is) from a .NET 5 console app.

Target .Net Standard 2.0

I think we could simplify our targeting by moving to .Net Standard 2.0.

This would have some implications for backwards compatibility. As per the table of implementation support, calling projects would need to be at least .Net Core 2.0 or .Net Framework 4.6.1.

.Net Standard 2.0 was released in August 2017, so isn't all that new in the grand scheme of things, but I'd be curious to hear if this will be a deal breaker for anyone?

The payoff is that we can drop the explicit targeting of .Net Framework from the core library. This opens up development to users who aren't on Windows or using Visual Studio.

Like I said, keen to hear thoughts on this.

Can we rationalise our test data classes?

Currently we have four classes in the ConTabsTestData project that exist solely for the purposes of testing and demoing:

  1. DemoDataType
  2. TestDataType
  3. MinimalDataType
  4. InvalidTestDataType

This seems like too many. (And we're proposing another called DemoAnimals in #21)

It seems to me that at most we'd need one for testing, one for demoing and one that's invalid. We may even be able to collapse testing and demoing into a single class.

Can we make a list of things that would be useful in each scenario? Once we've done that, we may be able to rationalise this list into a smaller one, which will be more lightweight and easier to maintain.

New unicode styles

Doubled walled

โ•“โ”€โ”€โ•ฅโ”€โ”€โ•–
โ•‘  โ•‘  โ•‘ 
โ•Ÿโ”€โ”€โ•ซโ”€โ”€โ•ข
โ•‘  โ•‘  โ•‘ 
โ•™โ”€โ”€โ•จโ”€โ”€โ•œ 

Double floored

โ•’โ•โ•โ•คโ•โ•โ••
โ”‚  โ”‚  โ”‚
โ•žโ•โ•โ•ชโ•โ•โ•ก
โ”‚  โ”‚  โ”‚
โ•˜โ•โ•โ•งโ•โ•โ•› 

Specify overflow behaviour for long strings

Expanding on #5, there may be a range of things we want to happen when our data contains a long string:

  1. Show it all on one line, making the column very wide. This is the current behaviour, but seems suboptimal.
  2. We may want to wrap the text as suggested in #5, so that we can control the width at the expense of the height of the row.
  3. Another option would be to specify a length at which the strings in a column should be truncated.

I suggest we add an enum field to the column type so that these behaviours can be selected. We would also need a width column for options 2 and 3, so that we would know when to wrap/truncate the string.

Question: What's a sensible default behaviour?

Feature: allow tables to be "refreshed" with a set of data

In some use cases it might be helpful to allow a table to be redrawn with new data. For instance, I may want to grab new data every 5 seconds, clear the console and redraw the table with this new data.

It would be great if a we had a method like table<T>.Refresh(IEnumerable<T> NewData).

For this to work well, we would need to preserve everything except the data. I can think of two areas where this may be problematic:

  1. Column widths - perhaps we'd only preserve these if they'd been explicitly set? Would have to experiment. It might be hard to read a table if the columns keep growing and shrinking.
  2. Calculated columns - we'd need to mark them as computed and store the function, so we could recalculate the values when we get new data.

So it'd be a fair chunk of work, but I think this would be a really interesting addition.

Any thoughts?

Handle nulls in a more dignified manner

It seems to me that the expected behaviour for null values should be an empty string, not a NullReferenceException as is currently the case.

var Data = DemoDataProvider.ListOfDemoData();
Data[0].StringCol = null;
var table = Table<DemoDataType>.Create(Data);
Console.WriteLine(table.ToString());

This should be rendered like:

+-----------+--------+
| StringCol | IntCol |
+-----------+--------+
|           | 2      |
| Dogs      | 1      |
| Chickens  | 3      |
+-----------+--------+

This will help if/when we start to tackle anonymous objects (e.g. #35).

ConTabs table output oneliner?

Sometimes we want to spit out a table ASAP and are happy with all the default options.

We'd want to do something like:

Console.WriteLine(Table<Planet>.QuickString(planets));

Add more styles

Since 42b3ffc it has been possible to build in styles. There aren't currently very many of these.

Let's add some more styles to ConTabs.

Error when installing

Why am I getting these errors?

`Install-Package : NU1108: Cycle detected.
ConTabs.tdwright -> ConTabs.tdwright (>= 1.2.0).
At line:1 char:1
Install-Package ConTabs.tdwright -Version 1.2.0
CategoryInfo : NotSpecified: (:) [Install-Package], Exception
FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand

Install-Package : Package restore failed. Rolling back package changes for 'ConTabs'.
At line:1 char:1
Install-Package ConTabs.tdwright -Version 1.2.0
CategoryInfo : NotSpecified: (:) [Install-Package], Exception
FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand`

Proper documentation

As ConTabs gets more feature-rich, it might be worth documenting it properly.

Topics to include:

  • Basic usage
  • Styling (built-in and custom)
  • Hiding columns
  • Using format strings (e.g. for currency data)
  • Changing how long strings are handled

Each topic should have relevant examples.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.