Help:Table
- Help:Table
This page provides a comprehensive guide to creating and formatting tables in MediaWiki, geared towards beginners. Tables are a fundamental tool for organizing and presenting information clearly and concisely on wiki pages. This guide will cover basic table syntax, advanced formatting options, and best practices for creating accessible and visually appealing tables.
Basic Table Syntax
The foundation of any MediaWiki table is built using pipes (|) and horizontal rules (---). Let's break down the simplest possible table:
```wiki
Header 1 | Header 2 | Header 3 |
---|---|---|
Row 1, Cell 1 | Row 1, Cell 2 | Row 1, Cell 3 |
Row 2, Cell 1 | Row 2, Cell 2 | Row 2, Cell 3 |
```
Let's dissect this code:
- `{| class="wikitable"`: This is the opening tag for the table. `class="wikitable"` applies a pre-defined style to the table, giving it a basic bordered appearance. Other classes can be used for different styling (see Help:CSS for more information).
- `|-`: This indicates the start of a new *table row*. Each `|-` creates a horizontal row in the table.
- `! Header 1`: The exclamation mark (`!`) denotes a *header cell*. Header cells are typically bold and used to label the columns.
- `| Row 1, Cell 1`: The pipe symbol (`|`) separates *data cells* within a row.
- `|} `: This is the closing tag for the table.
This will render a table with three columns and two rows, including a header row.
Understanding Table Cells
There are three primary types of table cells:
- **Header Cells (!):** Used for column headings. They are typically bold and centered by default.
- **Data Cells (|):** Contain the actual data within the table.
- **Empty Cells (|):** Leaving a pipe symbol without any content creates an empty cell.
Adding More Rows and Columns
Adding more rows is simple: just insert another `|-` followed by the cells for that row. Adding more columns requires adding more cells to each row, including the header row.
```wiki
Header 1 | Header 2 | Header 3 | Header 4 |
---|---|---|---|
Row 1, Cell 1 | Row 1, Cell 2 | Row 1, Cell 3 | Row 1, Cell 4 |
Row 2, Cell 1 | Row 2, Cell 2 | Row 2, Cell 3 | Row 2, Cell 4 |
```
This creates a table with four columns and two rows.
Table Attributes and Styling
The `class` attribute is just the beginning. You can add many other attributes to the opening `{|` tag to control the table's appearance and behavior. Here are some common ones:
- `border="1"`: Adds a basic border to the table. While `class="wikitable"` is generally preferred, this is a simple way to add a border.
- `width="100%"`: Makes the table fill the entire width of its container.
- `style="text-align: center;"`: Centers the text within all cells of the table. You can use more complex CSS styling here as well. See Help:CSS for details.
- `align="center"`: Centers the table itself horizontally on the page.
- `summary="A brief description of the table's content"`: Provides a text summary of the table's purpose, helpful for Help:Accessibility and screen readers.
Example:
```wiki
Strategy | Win Rate | Average Profit | Risk/Reward Ratio |
---|---|---|---|
Moving Average Crossover | 60% | 1.5x | 1:2 |
RSI Divergence | 55% | 2x | 1:3 |
Fibonacci Retracement | 65% | 1.2x | 1:1.5 |
```
This creates a bordered table that fills 80% of the page width, centers the text, and has a summary describing its content. The table displays data related to trading strategies, including win rate, average profit, and risk/reward ratio. This information is crucial for Technical Analysis.
Cell Attributes and Formatting
You can also apply attributes and formatting to individual cells.
- `style="background-color:#f0f0f0;"`: Sets the background color of the cell. Use hexadecimal color codes or named colors.
- `style="font-weight: bold;"`: Makes the text in the cell bold.
- `style="text-align: right;"`: Right-aligns the text in the cell.
- `| colspan="2"`: Makes a cell span across two columns.
- `| rowspan="2"`: Makes a cell span across two rows.
- `| class="example"`: Applies a custom class defined in the wiki's CSS.
Example:
```wiki
Header 1 | Header 2 | Header 3 |
---|---|---|
Data 1 | Data 2 | Data 3 |
This cell spans two columns. | Data 6 | |
This cell spans two rows. | Data 8 | Data 9 |
```
This example demonstrates how to change the background color of a cell, span cells across multiple rows and columns, and use custom styles.
Spanning Cells (colspan and rowspan)
`colspan` and `rowspan` are powerful attributes for creating complex table layouts.
- `colspan="n"`: Merges *n* columns into a single cell. The cell will occupy the width of those *n* columns. It must be placed within the cell's content (e.g., `| colspan="2" Data`).
- `rowspan="n"`: Merges *n* rows into a single cell. The cell will occupy the height of those *n* rows. It must be placed within the cell's content (e.g., `| rowspan="2" Data`).
- Important Considerations:**
- When using `rowspan`, ensure that subsequent rows have the correct number of cells to compensate for the spanned cell. You may need to add empty cells (`|`) to maintain the table's structure.
- `colspan` and `rowspan` can significantly impact table accessibility. Use them judiciously and provide alternative text explanations if necessary.
Table Sorting
MediaWiki supports basic table sorting using the `sortable` class.
```wiki
Header 1 | Header 2 | Header 3 |
---|---|---|
Data 1 | Data 2 | Data 3 |
Data 4 | Data 5 | Data 6 |
```
This will add small arrow icons to the header cells, allowing users to click on them to sort the table by that column. The sorting is typically numeric or alphabetical, depending on the data type. Keep in mind that sorting functionality relies on JavaScript being enabled in the user's browser.
Advanced Table Techniques
- **Nested Tables:** Tables can be nested within other tables for complex layouts. However, excessive nesting can make the code difficult to read and maintain.
- **Templates:** For frequently used table structures, consider creating a Help:Templates to simplify code reuse.
- **CSS Styling:** For more advanced styling options, use custom CSS defined in the wiki's stylesheet. Help:CSS provides detailed information on CSS.
- **Using Lua Modules:** For very complex table generation and manipulation, you can use Lua modules. This requires some programming knowledge.
Best Practices for Table Creation
- **Keep it Simple:** Avoid overly complex table structures. Prioritize clarity and readability.
- **Use Header Rows:** Always include header rows to clearly label the columns.
- **Provide a Summary:** Use the `summary` attribute to describe the table's content for accessibility.
- **Use Appropriate Classes:** Leverage pre-defined classes like `wikitable` for consistent styling.
- **Consider Accessibility:** Ensure that your tables are accessible to users with disabilities. Provide alternative text descriptions and avoid excessive use of `colspan` and `rowspan`. See Help:Accessibility.
- **Consistent Formatting:** Maintain consistent formatting throughout the table, such as alignment and number formatting.
- **Avoid Using Tables for Layout:** Do not use tables solely for page layout. Use CSS for layout purposes. Tables should be reserved for displaying tabular data.
- **Data Integrity:** Ensure the accuracy and consistency of data within the table.
- **Relevance to the Topic:** Ensure the table data is relevant to the article's main topic, such as Candlestick Patterns or Elliott Wave Theory. Tables displaying data on Moving Averages, Bollinger Bands, or MACD should be clearly explained within the context of the article.
- **Consider Data Visualization:** For complex datasets, consider whether a chart or graph might be a more effective way to present the information. Chart extensions may be available for your wiki.
- **Understand Market Sentiment:** Tables can be used to present data on market sentiment indicators like the VIX or Put/Call Ratio.
- **Analyze Price Action:** Use tables to organize data related to price action analysis, such as support and resistance levels, or chart patterns.
- **Manage Risk:** Display risk management parameters like stop-loss orders and take-profit levels in a clear table format.
- **Monitor Economic Indicators:** Present key economic indicators like GDP, inflation rates, and unemployment figures in tables to show their impact on the market.
- **Track Portfolio Performance:** Use tables to track the performance of your trading portfolio, including gains, losses, and overall return.
- **Compare Different Assets:** Create tables to compare the characteristics of different assets, such as stocks, bonds, and commodities.
- **Evaluate Trading Systems:** Show the performance statistics of different trading systems in a table format, including backtesting results and live trading data. Consider using data related to Ichimoku Cloud or Parabolic SAR.
- **Analyze Trading Volume:** Present data on trading volume to identify trends and potential breakouts. Consider using Volume Price Trend (VPT) as an indicator.
- **Understand Correlation:** Show the correlation between different assets in a table to identify diversification opportunities.
- **Identify Divergences:** Use tables to present data illustrating divergences between price and indicators, such as RSI divergence or MACD divergence.
- **Confirm Trends:** Utilize tables to display data confirming the strength and direction of market trends, utilizing indicators such as Average Directional Index (ADX) or Fibonacci Extensions.
- **Assess Market Volatility:** Present data on market volatility using indicators like Average True Range (ATR) or Standard Deviation.
- **Monitor Support and Resistance:** Maintain a table of key support and resistance levels to aid in trade planning.
- **Backtesting Results:** Display backtesting results for trading strategies in a well-structured table. Include metrics like profit factor, maximum drawdown, and win rate.
- **Trading Journal:** Use tables to maintain a detailed trading journal, recording entry and exit points, rationale, and outcomes.
- **Fundamental Analysis Data:** Organize fundamental analysis data, like price-to-earnings ratios or debt-to-equity ratios, in a table format.
- **Sector Performance:** Compare the performance of different sectors of the market using a table.
- **Currency Pair Analysis:** Display key data for currency pairs, such as interest rate differentials and economic calendars.
Resources
- Help:Formatting
- Help:CSS
- Help:Templates
- Help:Accessibility
- [MediaWiki Table Syntax](https://www.mediawiki.org/wiki/Manual:Tables)
Technical Analysis Candlestick Patterns Moving Averages Bollinger Bands MACD Elliott Wave Theory Fibonacci Retracement RSI Divergence VIX Put/Call Ratio Ichimoku Cloud Parabolic SAR Volume Price Trend (VPT) Average Directional Index (ADX) Fibonacci Extensions Average True Range (ATR) Standard Deviation Chart extensions Help:Templates Help:CSS Help:Accessibility Help:Formatting Trading Strategies Market Sentiment Risk Management Economic Indicators
Start Trading Now
Sign up at IQ Option (Minimum deposit $10) Open an account at Pocket Option (Minimum deposit $5)
Join Our Community
Subscribe to our Telegram channel @strategybin to receive: ✓ Daily trading signals ✓ Exclusive strategy analysis ✓ Market trend alerts ✓ Educational materials for beginners