Car Sales

About cars

                   mpg cyl disp  hp drat    wt  qsec vs am gear carb
Mazda RX4         21.0   6  160 110 3.90 2.620 16.46  0  1    4    4
Mazda RX4 Wag     21.0   6  160 110 3.90 2.875 17.02  0  1    4    4
Datsun 710        22.8   4  108  93 3.85 2.320 18.61  1  1    4    1
Hornet 4 Drive    21.4   6  258 110 3.08 3.215 19.44  1  0    3    1
Hornet Sportabout 18.7   8  360 175 3.15 3.440 17.02  0  0    3    2
Valiant           18.1   6  225 105 2.76 3.460 20.22  1  0    3    1

🎯 Sales Target

📈 Monthly Sales vs Target

Column2

Customers

1200

Car Showroom

Car Showroom
Car Showroom
---
title: "Sales Target Dashboard"
output: 
  flexdashboard::flex_dashboard:
    orientation: columns
    vertical_layout: scroll
    theme: yeti #"default", "bootstrap", "cerulean", "cosmo", "darkly", "flatly", "journal", "lumen", "paper", "readable", "sandstone", "simplex", "spacelab", "united", "yeti"
    source_code: embed
    self_contained: true
    social: menu
---

```{r setup, include=FALSE}
library(flexdashboard)
library(ggplot2)
library(dplyr)
library(tidyverse)
library(plotly)

```
# Car Sales {data-icon="fa-car"}

## About cars

```{r}
head(mtcars)
```






### 🎯 Sales Target

```{r}
data(mtcars)
sales <- mtcars$mpg
target <- 30
actual <- mean(sales)
```

```{r}
gauge(actual, min = 0, max = target,
      sectors = gaugeSectors(
        success = c(target*0.8, target),
        warning = c(target*0.5, target*0.8),
        danger = c(0, target*0.5)
      ),
      label = "Sales Achievement")
```

### 📈 Monthly Sales vs Target

```{r}
df <- data.frame(
  Month = 1:12,
  Sales = sales[1:12]
)

ggplot(df, aes(Month, Sales)) +
  geom_line(size=1, color="blue") +
  geom_point(size=2) +
  geom_hline(yintercept = target, color="red", linetype="dashed") +
  labs(title="Monthly Sales vs Target",
       y="Sales", x="Month")
```

## Column2

### Customers

```{r}

valueBox(1200,
         caption = "Total Customers",
         icon="fa-users",
         color="lavender")

```

### Car Showroom

![Car Showroom](images/carshowroom.jpg)

# Motor Trends {data-icon="fa-tachometer"}

## Histogram {.tabset}

### MPG Distribution
```{r}
ggplot(mtcars, aes(x=mpg)) +
  geom_histogram(binwidth=2, fill="steelblue", color="white") +
  labs(title="Distribution of Miles Per Gallon", x="MPG", y="Count") +
  theme_minimal()
```


### Horsepower Distribution
```{r}
ggplot(mtcars, aes(x=hp)) +
geom_histogram(binwidth=20, fill="darkgreen", color="white") +
labs(title="Distribution of Horsepower", x="HP", y="Count") +
theme_minimal()
```

## Pie Chart {.tabset}
### Cars by Cylinder
```{r}
cyl_table <- table(mtcars$cyl)


colors <- c("#66c2a5", "#fc8d62", "#8da0cb")  

pie(
  cyl_table,
  labels = paste0(names(cyl_table), " cyl (", cyl_table, ")"),
  col = colors,
  main = "Proportion of Cars by Cylinders",
  border = "white",
  clockwise = TRUE,
  radius = 1
)
```